lua脚本文件
--cCallLuaTest.lua
--read variable
var_int = 5
var_str = "hello,lua!!!"
var_bool = true
var_table_color = {r=12,g=34,b=56}
--call function
var_fun1 = function(a,b)
print("hello,world!!!")
return a+b
end
var_fun2 = function(a,b)
return a+b,a*a+b*b
end
c++文件
/*C/C++调用Lua
*/
#include<iostream>
using namespace std;
#include<lua.hpp>
void read_lua_variable(lua_State *L)
{
//void lua_getglobal (lua_State *L, const char *name);把全局变量 name ......
阅读全文