Allows standalone Lua scripts to be splitted (the wizard was over 20k)
This commit is contained in:
+9
-2
@@ -1234,15 +1234,22 @@ void luaTask(uint8_t evt)
|
|||||||
lua_pushinteger(L, evt);
|
lua_pushinteger(L, evt);
|
||||||
if (lua_pcall(L, 1, 1, 0) == 0) {
|
if (lua_pcall(L, 1, 1, 0) == 0) {
|
||||||
if (!lua_isnumber(L, -1)) {
|
if (!lua_isnumber(L, -1)) {
|
||||||
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);
|
||||||
|
|||||||
Reference in New Issue
Block a user