commit de8cc0ff726fa3b4375b51c0738218064624f71f
Author: Jon Bell <jondbell@protonmail.com>
AuthorDate: Thu Apr 23 16:24:49 2020 -0600
Commit: Jon Bell <jondbell@protonmail.com>
CommitDate: Thu Apr 23 16:24:49 2020 -0600
Wire up camera call from lua and fix getting y arg
---
source/console.cpp | 1 +
source/picoluaapi.cpp | 2 +-
source/picoluaapi.h | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/source/console.cpp b/source/console.cpp
index 56155b7..991a1d8 100644
--- a/source/console.cpp
+++ b/source/console.cpp
@@ -75,6 +75,7 @@ void Console::LoadCart(std::string filename){
lua_register(_luaState, "fset", fset);
lua_register(_luaState, "sget", sget);
lua_register(_luaState, "sset", sset);
+ lua_register(_luaState, "camera", camera);
//input
lua_register(_luaState, "btn", btn);
diff --git a/source/picoluaapi.cpp b/source/picoluaapi.cpp
index 6681f6d..b4a91fe 100644
--- a/source/picoluaapi.cpp
+++ b/source/picoluaapi.cpp
@@ -372,7 +372,7 @@ int camera(lua_State *L) {
if (lua_gettop(L) > 0) {
x = lua_tointeger(L,1);
}
- if (lua_gettop(L) < 1) {
+ if (lua_gettop(L) > 1) {
y = lua_tointeger(L,2);
}
diff --git a/source/picoluaapi.h b/source/picoluaapi.h
index 27c1aa2..701cb0a 100644
--- a/source/picoluaapi.h
+++ b/source/picoluaapi.h
@@ -31,6 +31,7 @@ int fget(lua_State *L);
int fset(lua_State *L);
int sget(lua_State *L);
int sset(lua_State *L);
+int camera(lua_State *L);
//input api
int btn(lua_State *L);