summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
Diffstat (limited to 'scripting')
-rw-r--r--scripting/test.cpp7
-rw-r--r--scripting/test.h1
-rw-r--r--scripting/test.pkg1
3 files changed, 9 insertions, 0 deletions
diff --git a/scripting/test.cpp b/scripting/test.cpp
index 1a378b7..5ec27da 100644
--- a/scripting/test.cpp
+++ b/scripting/test.cpp
@@ -9,3 +9,10 @@ void print(lua_State *L, const char *s) {
lua_pop(L, 1);
lua->print(s);
}
+
+void say(lua_State *L, const char *s) {
+ lua_getglobal(L, "lua_instance");
+ Lua *lua = static_cast<Lua*>(lua_touserdata(L, -1));
+ lua_pop(L, 1);
+ lua->say(s);
+}
diff --git a/scripting/test.h b/scripting/test.h
index 48f560e..7ff5719 100644
--- a/scripting/test.h
+++ b/scripting/test.h
@@ -4,5 +4,6 @@
#include <lua.hpp>
void print(lua_State *L, const char *s);
+void say(lua_State *L, const char *s);
#endif
diff --git a/scripting/test.pkg b/scripting/test.pkg
index 38525c6..0f64be7 100644
--- a/scripting/test.pkg
+++ b/scripting/test.pkg
@@ -1,5 +1,6 @@
$hfile "scripting/test.h"
void print(lua_State *L, const char *s);
+void say(lua_State *L, const char *s);
// vim: syn=cpp