糖果实验室杂货铺

Candy Lab

C调用Lua函数返回数值数据

3 months ago 0

C调用Lua函数返回数值数据

None
1
2
3
4
5
6
7
8
9
10
if (luaL_loadfile(L, "config.lua") || lua_pcall(L, 0,1,0))
      printf("Cannot run configuration file:%s", lua_tostring(L, -1));

  lua_getglobal(L, "format");
  lua_pcall(L, 0,1,0);
  double z = 0.0;
  z = lua_tonumber(L, -1);
  lua_pop(L, 1); 
  printf("%f\n", z); 
  lua_close(L);

糖果实验室

Openresty中文编程网
IKBC经典机械键盘
机械键盘领券优惠购买

Write a Comment