local ps=Monitor.GetHisDetail('mnX002')//lua脚本调用C++程序第一个参数为字符类型
local ps=Monitor.GetHisDetail(1642)//第一个参数为数字类型
if (lua_isnumber(L, 1))
{
userID = lua_tointeger(L, 1);
}
else if (lua_isstring(L, 1))
{
userID = tradeDtail_Data->getUserID(QString::fromLocal8Bit(lua_tostring(L, 1)));
}//C++代码获取LUA传递的参数,这是正确写法
if (lua_isstring(L, 1))//当传递为数字的时候判断为字符类型的时候返回的是true
{
userID = tradeDtail_Data->getUserID(QString::fromLocal8Bit(lua_tostring(L, 1)));
}
else if (lua_isnumber(L, 1))
{
userID = lua_tointeger(L, 1);
}//经过比较当传递的参数为字符类型和数字类型的时候判断为字符类型都会通过