mirror of
https://github.com/devZoGok/gameBase.git
synced 2026-08-27 03:53:31 +00:00
added code execution method
This commit is contained in:
+9
-5
@@ -19,13 +19,17 @@ namespace gameBase{
|
||||
}
|
||||
|
||||
void LuaManager::buildScript(vector<string> files){
|
||||
string script = "";
|
||||
string script = "";
|
||||
|
||||
for(string f : files)
|
||||
script += "dofile(\"" + f + "\");";
|
||||
for(string f : files)
|
||||
script += "dofile(\"" + f + "\");";
|
||||
|
||||
if(luaL_dostring(state, script.c_str()) && lua_pcall(state, 0, 0, 0))
|
||||
cout << "Error building Lua script\n";
|
||||
executeCode(script, "Error building script(s)\n");
|
||||
}
|
||||
|
||||
void LuaManager::executeCode(string code, string errMsg){
|
||||
if(luaL_dostring(state, code.c_str()) && lua_pcall(state, 0, 0, 0))
|
||||
cout << errMsg;
|
||||
}
|
||||
|
||||
int LuaManager::getInt(string varName){
|
||||
|
||||
Reference in New Issue
Block a user