check if script has Update function

This commit is contained in:
Bluub
2021-06-20 22:00:51 +02:00
parent 605a795f33
commit 5d9fb5b09c
@@ -20,6 +20,12 @@ namespace BBM
{
if (std::filesystem::exists(scriptPath)) {
_state.dofile(scriptPath);
_state.getGlobal("Update");
if (lua_isfunction(_state.getState(), -1)) {
_state.popLast();
} else {
throw Error("Lua script doesn't have Update function");
}
}
else {
throw Error("Couldn't load lua script: " + scriptPath);