static int lua_Locate( lua_State* L )
{
long handle = lua_tonumber( L, 1 );
const char* beacon_rssi_json = lua_tostring( L, 2 );
vector<RSSI_INFO> rssi_info_vec;
FingerprintLocationServer* p = (FingerprintLocationServer*)handle;
ConvertJson2CppRSSI( beacon_rssi_json, rssi_info_vec );
double x;
double y;
float floor;
p->UpdateBeaconSignalGetResult( rssi_info_vec, x, y, floor );
lua_pushnumber(L,x);
lua_pushnumber(L,y);
lua_pushnumber(L,floor);
return 3;
}
static const struct luaL_Reg myLib[] =
{
{"lua_Locate", lua_Locate},
{NULL, NULL} //数组中最后一对必须是{NULL, NULL},用来表示结束
};
int luaopen_mLualib(lua_State *L)
{
luaL_register(L, "FPCalc", myLib);
return 1; // 把myLib表压入了栈中,所以就需要返回1
}
lua entry thread aborted: runtime error: error loading module 'mLualib' from file '/var/wdd/wrs/webroot/intelligent_lua/mLualib.so': /var/wdd/wrs/webroot/intelligent_lua/mLualib.so: undefined symbol: _Z13lua_tolstringP9lua_StateiPm stack traceback: coroutine 0: [C]: in function 'require' /var/wdd/wrs/webroot/intelligent_lua/location.lua:18: in function...
no file './mLualib.lua' no file '/usr/local/openresty/luajit/share/luajit-2.1.0-beta1/mLualib.lua' no file '/usr/local/share/lua/5.1/mLualib.lua' no file '/usr/local/share/lua/5.1/mLualib/init.lua' no file '/usr/local/openresty/luajit/share/lua/5.1/mLualib.lua' no file '/usr/local/openresty/luajit/share/lua/5.1/mLualib/init.lua' no file '/usr/local/openresty/lualib/mLualib.so' no file './mLualib.so' no file '/usr/local/lib/lua/5.1/mLualib.so' no file '/usr/local/openresty/luajit/lib/lua/5.1/mLualib.so' no file '/usr/local/lib/lua/5.1/loadall.so' no file '/var/wdd/wrs/webroot/intelligent_lua/mLualib.so'
local FPCalc = require "mLualib" local x, y, floor = FPCalc.lua_Locate(c_addr, umm_json) ngx.log(ngx.ERR, "lua_Locate:end:返回结果:", "x=" .. x, " y=" .. y, " floor=" .. floor)
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有