summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/script_system.cpp4
-rw-r--r--src/script_system.h1
2 files changed, 5 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;
diff --git a/src/script_system.h b/src/script_system.h index 7ef2dee..6a28430 100644 --- a/src/script_system.h +++ b/src/script_system.h
@@ -32,6 +32,7 @@ private:
32 struct Script { 32 struct Script {
33 std::unique_ptr<sol::thread> runner; 33 std::unique_ptr<sol::thread> runner;
34 std::unique_ptr<sol::coroutine> callable; 34 std::unique_ptr<sol::coroutine> callable;
35 std::string debugInfo;
35 }; 36 };
36 37
37 Game& game_; 38 Game& game_;