#include"CmethodForLua.h"
void main()
{
lua_State*luaEnv = NULL;
int retCode;
retCode= OpenLuaExecuteEnvironment(&luaEnv);
if (retCode != LUA_SUCCESS)
{
return;
}
//Lua调用C语言函数,
retCode = luaL_dofile(luaEnv,"compute.lua");
if (retCode != LUA_SUCCESS) { printf("error %s\n",lua_tostring(luaEnv,-1));
return;
}
CloseLuaExecuteEnvironment(luaEnv);
}View Code
(4)输出结果
The Print Data is 30
CentOS 编译安装 Lua LuaSocket