summaryrefslogtreecommitdiffstats
path: root/src/control/ScriptContext.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/control/ScriptContext.hpp')
-rw-r--r--src/control/ScriptContext.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/control/ScriptContext.hpp b/src/control/ScriptContext.hpp
index 23f0fab..86c8c0f 100644
--- a/src/control/ScriptContext.hpp
+++ b/src/control/ScriptContext.hpp
@@ -26,6 +26,8 @@
#pragma once
+#include "../model/ScriptValue.hpp"
+
extern "C" {
#include <lua.h>
#include <lualib.h>
@@ -100,6 +102,11 @@ public:
lua_close(L);
}
+ void setGlobal(const std::string &key, Model::ScriptValue *value) {
+ value->push(L);
+ lua_setglobal(L, key.c_str());
+ }
+
void load(const std::string &name) {
std::string filename = "../resources/script/" + name + ".lua";