diff options
Diffstat (limited to 'src/luabind-test.cpp')
-rw-r--r-- | src/luabind-test.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/luabind-test.cpp b/src/luabind-test.cpp new file mode 100644 index 0000000..02f2638 --- /dev/null +++ b/src/luabind-test.cpp @@ -0,0 +1,29 @@ +#include <iostream> +#include <luabind/luabind.hpp> +#include <lua.hpp> + +void greet() +{ + std::cout << "hello world!\n"; +} + +extern "C" int init(lua_State* L) +{ + using namespace luabind; + + open(L); + + module(L) + [ + def("greet", &greet) + ]; + + return 0; +} + +int main() +{ + lua_State* L = luaL_newstate(); + init(L); + luaL_dostring(L, "greet()"); +} |