diff --git a/lute/cli/src/climain.cpp b/lute/cli/src/climain.cpp index 6af5f23b0..eb0235dba 100644 --- a/lute/cli/src/climain.cpp +++ b/lute/cli/src/climain.cpp @@ -68,9 +68,9 @@ lua_State* setupCliState(Runtime& runtime, std::function preSa ); } -bool setupArguments(lua_State* L, int argc, char** argv) +static bool setupArguments(lua_State* L, int argc, char** argv) { - if (!lua_checkstack(L, argc + 1)) + if (!lua_checkstack(L, argc)) return false; for (int i = 0; i < argc; ++i) diff --git a/lute/runtime/src/ref.cpp b/lute/runtime/src/ref.cpp index be4e0f60f..60e13baba 100644 --- a/lute/runtime/src/ref.cpp +++ b/lute/runtime/src/ref.cpp @@ -23,6 +23,7 @@ void Ref::push(lua_State* L) const std::shared_ptr getRefForThread(lua_State* L) { + lua_rawcheckstack(L, 1); lua_pushthread(L); std::shared_ptr ref = std::make_shared(L, -1); lua_pop(L, 1);