Make ilua output iterable userdata as tables
This means anything with __len and __pairs metamethods.
This commit is contained in:
parent
ece5490fd9
commit
981fa93a40
1 changed files with 7 additions and 2 deletions
|
@ -84,8 +84,13 @@ function ilua.val2str(val)
|
|||
else
|
||||
return '{'..ilua.join(val,',')..'}'
|
||||
end
|
||||
--elseif tp == 'userdata' then
|
||||
|
||||
elseif tp == 'userdata' then
|
||||
local mt = getmetatable(val)
|
||||
if mt.__len and mt.__pairs then
|
||||
return '{'..ilua.join(val,',')..'}'
|
||||
else
|
||||
return tostring(val)
|
||||
end
|
||||
elseif tp == 'string' then
|
||||
return "'"..val.."'"
|
||||
elseif tp == 'number' then
|
||||
|
|
Loading…
Add table
Reference in a new issue