commit 54449800a57721bbbb32650fbe7431bb46908894
Author: Jon Bell <jondbell@protonmail.com>
AuthorDate: Sat Apr 25 17:21:59 2020 -0600
Commit: Jon Bell <jondbell@protonmail.com>
CommitDate: Sat Apr 25 17:21:59 2020 -0600
stub out stat() and return zero
---
source/picoluaapi.cpp | 17 ++++++++++++++---
source/picoluaapi.h | 3 ++-
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/source/picoluaapi.cpp b/source/picoluaapi.cpp
index 40956ea..d24bb00 100644
--- a/source/picoluaapi.cpp
+++ b/source/picoluaapi.cpp
@@ -27,6 +27,13 @@ int noop(const char * name) {
return 0;
}
+int noopreturns(lua_State *L, const char * name) {
+ //todo log name of unimplemented functions?
+ lua_pushnumber(L, 0);
+
+ return 1;
+}
+
/*functions to expose to lua*/
//Graphics
int cls(lua_State *L){
@@ -522,7 +529,7 @@ int btnp(lua_State *L){
return 1;
}
-//Time
+//System
int time(lua_State *L) {
int frameCount = _consoleForLuaApi->GetFrameCount();
int targetFps = _consoleForLuaApi->GetTargetFps();
@@ -534,6 +541,10 @@ int time(lua_State *L) {
return 1;
}
+int stat(lua_State *L) {
+ return noopreturns(L, "stat");
+}
+
//Audio
int music(lua_State *L) {
return noop("music");
@@ -557,7 +568,7 @@ int memset(lua_State *L) {
}
int peek(lua_State *L) {
- return noop("peek");
+ return noopreturns(L, "peek");
}
int poke(lua_State *L) {
@@ -574,7 +585,7 @@ int cartdata(lua_State *L) {
}
int dget(lua_State *L) {
- return noop("dget");
+ return noopreturns(L, "dget");
}
int dset(lua_State *L) {
diff --git a/source/picoluaapi.h b/source/picoluaapi.h
index 08dd247..4acd547 100644
--- a/source/picoluaapi.h
+++ b/source/picoluaapi.h
@@ -62,8 +62,9 @@ int btnp(lua_State *L);
int music(lua_State *L);
int sfx(lua_State *L);
-//time
+//system
int time(lua_State *L);
+int stat(lua_State *L);
//memory api
int cstore(lua_State *L);