HDB: Add getStringOffStack()

This commit is contained in:
Nipun Garg 2019-06-20 01:45:51 +05:30 committed by Eugene Sandulenko
parent 79023f0f9e
commit a9a2ee0479
2 changed files with 12 additions and 1 deletions

View File

@ -960,4 +960,14 @@ void LuaScript::checkParameters(const char *func, int params) {
}
}
const char *LuaScript::getStringOffStack() {
if (!_systemInit) {
return NULL;
}
const char *string = lua_tostring(_state, 1);
lua_remove(_state, 1);
return string;
}
}

View File

@ -44,6 +44,8 @@ public:
bool executeFile(const Common::String &filename);
void checkParameters(const char *func, int params);
const char *getStringOffStack();
private:
lua_State *_state;
int _pcallErrorhandlerRegistryIndex;
@ -56,7 +58,6 @@ private:
bool executeChunk(Common::String &chunk, uint chunkSize, const Common::String &chunkName) const;
void stripComments(char *chunk);
void addPatches(Common::String &chunk, const char *scriptName);
};
}