下载lua源码将src下面除了 lua.c和luac.c 的文件全部添加到项目中
#include <iostream>
#include "lua.hpp"
int main()
{
lua_State* L = luaL_newstate();
luaL_dostring(L, "x = 42");
lua_getglobal(L, "x");
lua_Number x = lua_tonumber(L, 1);
printf("x = %d
", (int)x);
lua_close(L);
}