--You received this message because you are subscribed to the Google Groups "lua-l" group.To unsubscribe from this group and stop receiving emails from it, send an email to lua-l+un...@googlegroups.com.To view this discussion visit https://groups.google.com/d/msgid/lua-l/27e289b7-8f1e-49ae-8393-6f31be88f1b6n%40googlegroups.com.
for k,v in pairs(buf.stones) do
print(type(k),k, type(v), v)
print(string.format("%q,%q", k,v))
end
leads to
...
number 1 number 11
"1","11"
string 80 number 4
"80","4"
--
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lua-l+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/lua-l/1eb5f53f-575e-42db-bc0e-947b62d7a761n%40googlegroups.com.
This is not a bug. LuaJIT does not implement Lua 5.4, it's based
on 5.1 / 5.2 primarily and cherry-picks features otherwise. And
the Lua 5.1 reference manual says:
"The q option formats a string in a form suitable to
be safely read
back by the Lua interpreter:
the string is written between double quotes,
and all double quotes, newlines, embedded zeros,
and backslashes in the string
are correctly escaped when written. [...] whereas q
and s expect a string."
So LuaJIT is correctly implementing 5.1 behavior here (and in fact
it is necessary that LuaJIT implements it like this for existing
5.1 code that runs on LuaJIT to continue working as-is).
%q also serializing floats precisely as hex is a newer thing.
- Lars
To view this discussion visit https://groups.google.com/d/msgid/lua-l/CAGa7JC290CKtkZV5YpePpyhf7Hh_uOnY_9AGySgA-ANAjT3XUg%40mail.gmail.com.