Files
pip/main.cpp
2020-07-22 22:20:54 +03:00

30 lines
615 B
C++

#include "pip.h"
#ifdef PIP_LUA
#include "piluaprogram.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");
PIString luaString = s.cast<PIString>();
int answer = n.cast<int>();
piCout << luaString;
piCout << "And here's our number:" << answer;
}
#else
int main() {
return 0;
}
#endif