上一边文章写lua的 lua 在gb28181中流程化技巧
下面写一个实际的作用,流程需要脚本化的程序,如 1 游戏逻辑 2 智能逻辑面板
逻辑面板的意思是通过拖拉的方式奠定程序的逻辑基础,这一定其实是和游戏非常相似。
c++ 程序extern "C" {
#include "../lualib/lua.h"
#include "../lualib/lualib.h"
#include "../lualib/lauxlib.h"
}
int main(int argc, char *argv[])
{
/* 初始化Lua */
L = luaL_newstate();
/* 载入Lua基本库 */
luaL_openlibs(L);
/* 注册函数 */
lua_register(L, "average", average);
luaopen_mLualib(L);
luaL_dofile(L, "test2.lua");
lua_getglobal(L, "mystr");
string str = lua_tostring(L, -1);
cout
关注
打赏