diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-10-05 15:46:50 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2014-10-05 15:46:50 +0200 |
commit | 1b250f668bf31bdfc9d4e7975daa23f3474c298a (patch) | |
tree | ce2747a7af60d7f5523fb80044d90cf28f5e3a1b /src/control/ScriptContext.hpp | |
parent | 36d4c9298f4be2d1c1fb803dc16948e3c11a3a49 (diff) | |
download | rpgedit-1b250f668bf31bdfc9d4e7975daa23f3474c298a.tar rpgedit-1b250f668bf31bdfc9d4e7975daa23f3474c298a.zip |
Implement mappings for Lua types
Diffstat (limited to 'src/control/ScriptContext.hpp')
-rw-r--r-- | src/control/ScriptContext.hpp | 7 |
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"; |