mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-05-30 09:08:35 +00:00
check if script has Update function
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user