lua userdata
发布时间:2020-12-14 22:14:46 所属栏目:大数据 来源:网络整理
导读:item['screenshots'] = {} for i,elem in pairs(_item) do if string.find(i,'SCREENSHOT') ~= nil then if type(elem) ~= 'userdata' then table.insert(item['screenshots'],'http://image.yuntongbu.com' .. elem) end end end 这个 userdata 跟 lua 的 n
item['screenshots'] = {} for i,elem in pairs(_item) do if string.find(i,'SCREENSHOT') ~= nil then if type(elem) ~= 'userdata' then table.insert(item['screenshots'],'http://image.yuntongbu.com' .. elem) end end end 这个 userdata 跟 lua 的 nil,'',false 是无法进行比较的,比较的结果都是 true 只能用 type() 来获取值类型,然后过滤 for k,v in pairs(data) do if string.find(tostring(k),'SCREENSHOT') ~= nil and type(v) ~= 'userdata' then if string.find(tostring(k),'IPAD') then table.insert(info.screenshots,'http://image.y.com' .. tostring(v)) else table.insert(info.iPad_screenshots,'http://image.y.com' .. tostring(v)) end end end (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |