programming in lua 有相关的例子,一般脚本语言和c/c++之类的互相调用分两类,一类是扩展,就是将c/c++模块封装起来给脚本语言用,用swig做封装很方便的,一类是嵌入,就是在c/c++等应用中嵌入lua引擎,一般是用来分离经常变化的逻辑部分,比如WOW就是用lua语言作为扩展,用户可以编写lua脚本来完成一些特定功能的机器人。你要做的就是使用lua c api来在你的程序中执行lua。类似这种:int iErr = 0;lua_State *lua = lua_open (); // Open Lualuaopen_io (lua); // Load io libraryif ((iErr = luaL_loadfile (lua, "test.lua")) == 0)// Call main...if ((iErr = lua_pcall (lua, 0, LUA_MULTRET, 0)) == 0) // Push the function name onto the stacklua_pushstring (lua, "helloWorld");// Function is located in the Global Tablelua_gettable (lua, LUA_GLOBALSINDEX); lua_pcall (lua, 0, 0, 0);lua_close (lua);追问