You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
local xml = require "xml"
local tb = {str='test',num=11}
local data = xml.dump(tb)
then i got this error:
lua: /usr/local/share/lua/5.3/xml/init.lua:142: attempt to index a number value (local 'v')
stack traceback:
/usr/local/share/lua/5.3/xml/init.lua:142: in upvalue 'escape'
/usr/local/share/lua/5.3/xml/init.lua:150: in upvalue 'tagWithAttributes'
/usr/local/share/lua/5.3/xml/init.lua:182: in upvalue 'doDump'
/usr/local/share/lua/5.3/xml/init.lua:195: in function 'xml.dump'
test.lua:25: in main chunk
[C]: in ?
i think you need to determine number type in init.lua L142
elseif type(v) == 'number' then
return tostring(v)
else
return v:gsub('&','&'):gsub('>','>'):gsub('<','<'):gsub("'",''')
end
the second :
when i encode this table:
local xml = require "xml"
local tb = {xml='xml',{xml='str','test'},{xml='num',33}}
print(xml.dump(tb))
i found that there is an unnecessary '\n' after the number 33, like this:
<xml>
<str>test</str>
<num>33
</num>
</xml>
fixed by this:
--init.lua line175, local function doDump
...
elseif typ == 'number' then
insert(output, tostring(child))
last = 's' --add this code to escape 'indent'
else
...
Hope this email finds you well.
The text was updated successfully, but these errors were encountered:
when i test xml lib ,i got two question;
the first one:
then i got this error:
i think you need to determine number type in init.lua L142
the second :
when i encode this table:
i found that there is an unnecessary '\n' after the number 33, like this:
fixed by this:
The text was updated successfully, but these errors were encountered: