From 1b250f668bf31bdfc9d4e7975daa23f3474c298a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 5 Oct 2014 15:46:50 +0200 Subject: Implement mappings for Lua types --- src/control/ScriptContext.hpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/control') 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 #include @@ -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"; -- cgit v1.2.3