文章目录
第一种方式
第二种方式
第一种方式
新建DLL空的win32工程,新建test.cpp文件,内容如下
/*Lua调用C/C++函数/库(动态链接方式)*/
#include<iostream>
using namespace std;
#include<lua.hpp>
static int math_abs(lua_State *L)
{
lua_pushnumber(L, abs((int)luaL_checknumber(L, 1)));
return 1;
}
static int math_cos(lua_State *L)
{
lua_pushnumber(L, cos((double)luaL_checknumber(L, 1)));
return 1;
}
static int math......
阅读全文