您的位置:首页 > 编程语言 > Lua

Lua调用C++的函数

2016-03-25 14:19 471 查看
#include "Study.h"

Study::Study()

{

}

Study::~Study()

{

}

int Study::ceshi(lua_State*L)

{

cout<<"测试成功"<<endl;

return 0;

}

int main()

{

int i = 0;

Study *study = new Study();

lua_State * L = luaL_newstate();

luaL_openlibs(L);

lua_register(L, "ceshi", Study::ceshi);

luaL_dofile(L, "2.lua");

getchar();

return 0;

}

/***********************************2.lua*******************************************/

ceshi();

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: