Allows standalone Lua scripts to be splitted (the wizard was over 20k)

This commit is contained in:
bsongis
2014-05-28 10:03:31 +02:00
parent 93c18d1b66
commit 8b641c1309
+8 -1
View File
@@ -1237,13 +1237,20 @@ void luaTask(uint8_t evt)
if (instructionsPercent > 100) { if (instructionsPercent > 100) {
TRACE("Script killed"); TRACE("Script killed");
standaloneScript.state = SCRIPT_KILLED; standaloneScript.state = SCRIPT_KILLED;
luaState = LUASTATE_RELOAD_MODEL_SCRIPTS;
}
else if (lua_isstring(L, -1)) {
char nextScript[_MAX_LFN+1];
strncpy(nextScript, lua_tostring(L, -1), _MAX_LFN);
nextScript[_MAX_LFN] = '\0';
luaExec(nextScript);
} }
else { else {
TRACE("Script error"); TRACE("Script error");
standaloneScript.state = SCRIPT_SYNTAX_ERROR; standaloneScript.state = SCRIPT_SYNTAX_ERROR;
}
luaState = LUASTATE_RELOAD_MODEL_SCRIPTS; luaState = LUASTATE_RELOAD_MODEL_SCRIPTS;
} }
}
else { else {
int scriptResult = lua_tointeger(L, -1); int scriptResult = lua_tointeger(L, -1);
lua_pop(L, 1); /* pop returned value */ lua_pop(L, 1); /* pop returned value */