lua-users home
lua-l archive

first 5.3 incompatibility I spot in my Lua code

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi all,
Just another experience report like many posted earlier here on the list.
I just noticed that `luarocks upload` was failing under Lua 5.3.0 (a
part of the code I didn't exercise early because, well, I can't upload
packages from the testsuite — yeah, yeah, I know I should make a mock
server and whatnot... contributions are welcome! ;) )
Turns out that when lua-cjson decodes numbers, it is always decoding
them as floats. And the code in luarocks/upload.lua was doing
something this:
api:method("upload_rock/" .. tostring(res.version.id))
I had to change it to this:
api:method("upload_rock/" .. ("%d"):format(res.version.id))
I know things like this have been discussed earlier on but I thought
I'd share this just to "bump" this tip for those going through
something similar now that 5.3 is out.
-- Hisham

AltStyle によって変換されたページ (->オリジナル) /