diff options
author | Boris Nagaev <bnagaev@gmail.com> | 2014-08-22 13:01:48 (GMT) |
---|---|---|
committer | Boris Nagaev <bnagaev@gmail.com> | 2014-08-22 15:39:21 (GMT) |
commit | 950ef6f85409d1f1bb00d33fb972e5c277cf5836 (patch) | |
tree | a790a00b0059d43e506af796e4b9c80e0c79986a /src/luabind-test.cpp | |
parent | 22612efbdbdf88bfdf78270d1d97a27f8c111658 (diff) | |
download | mxe-950ef6f85409d1f1bb00d33fb972e5c277cf5836.zip mxe-950ef6f85409d1f1bb00d33fb972e5c277cf5836.tar.gz mxe-950ef6f85409d1f1bb00d33fb972e5c277cf5836.tar.bz2 |
add luabind-test.cpp
all programs using luabind should define LUA_COMPAT_ALL
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()"); +} |