Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <luabind/luabind.hpp>
- #include <luaconf.h>
- #include <iostream>
- #define LUA_COMPAT_AL
- int main() {
- // Create a new lua state
- lua_State *myLuaState = luaL_newstate();
- // Connect LuaBind to this lua state
- luabind::open(myLuaState);
- // Define a lua function that we can call
- luaL_dostring(
- myLuaState,
- "function add(first, second)\n"
- " return first + second\n"
- "end\n"
- );
- std::cout << "Result: "
- << luabind::call_function<int>(myLuaState, "add", 2, 3)
- << std::endl;
- lua_close(myLuaState);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement