diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2011-06-12 21:51:47 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2011-06-12 21:51:47 +0200 |
commit | 48b4b813a51c374fce43a553608c67c6ca08ea37 (patch) | |
tree | 853cfe0c7551b44d3544f776e926e70e9382b121 /scripting | |
parent | b44b2cb4c16995d218e8d4c767c01c7b87c89816 (diff) |
Added a say() function to lua.
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/test.cpp | 7 | ||||
-rw-r--r-- | scripting/test.h | 1 | ||||
-rw-r--r-- | scripting/test.pkg | 1 |
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 |