#include "pip.h" extern "C" { # include "lua.h" # include "lauxlib.h" # include "lualib.h" } #include #include "pistring_std.h" static const char * script = "-- script.lua \n" "testString = \"LuaBridge works!\" \n" "number = 42 \n"; using namespace luabridge; int main() { lua_State* L = luaL_newstate(); luaL_dostring(L, script); luaL_openlibs(L); lua_pcall(L, 0, 0, 0); LuaRef s = getGlobal(L, "testString"); LuaRef n = getGlobal(L, "number"); std::string luaString = s.cast(); int answer = n.cast(); piCout << StdString2PIString(luaString); piCout << "And here's our number:" << answer; }