summary refs log tree commit diff stats
path: root/src/script_system.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2021-03-13 15:30:20 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2021-03-13 15:34:50 -0500
commit4c8e15722822d0e5e872f872838a8d71af84e1d4 (patch)
tree76ee8a4f8ee5bd24067b4d94b1a5dc2594dd5444 /src/script_system.cpp
parent02c991e5ea1ec93c8245157a3f174b547774a7e3 (diff)
downloadtanetane-4c8e15722822d0e5e872f872838a8d71af84e1d4.tar.gz
tanetane-4c8e15722822d0e5e872f872838a8d71af84e1d4.tar.bz2
tanetane-4c8e15722822d0e5e872f872838a8d71af84e1d4.zip
Added debug info to Script object
Diffstat (limited to 'src/script_system.cpp')
-rw-r--r--src/script_system.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/script_system.cpp b/src/script_system.cpp index b993938..7889148 100644 --- a/src/script_system.cpp +++ b/src/script_system.cpp
@@ -286,6 +286,9 @@ void ScriptSystem::runScript(std::string mapName, std::string scriptName) {
286 Script newScript; 286 Script newScript;
287 newScript.runner.reset(new sol::thread(sol::thread::create(engine_.lua_state()))); 287 newScript.runner.reset(new sol::thread(sol::thread::create(engine_.lua_state())));
288 newScript.callable.reset(new sol::coroutine(newScript.runner->state().traverse_get<sol::function>(mapName, scriptName))); 288 newScript.callable.reset(new sol::coroutine(newScript.runner->state().traverse_get<sol::function>(mapName, scriptName)));
289#ifdef TANETANE_DEBUG
290 newScript.debugInfo = mapName + "." + scriptName;
291#endif
289 292
290 if (!*newScript.callable) { 293 if (!*newScript.callable) {
291 throw std::runtime_error("Error running script: " + mapName + "." + scriptName); 294 throw std::runtime_error("Error running script: " + mapName + "." + scriptName);
@@ -313,6 +316,7 @@ void ScriptSystem::runDebugScript(std::string script) {
313 } 316 }
314 317
315 newScript.callable.reset(new sol::coroutine(loaded_script)); 318 newScript.callable.reset(new sol::coroutine(loaded_script));
319 newScript.debugInfo = script;
316 320
317 if (!*newScript.callable) { 321 if (!*newScript.callable) {
318 std::cout << "Error running debug command: " << script << std::endl; 322 std::cout << "Error running debug command: " << script << std::endl;