-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lume.format(str, table) doesn't properly handle false values #35
Comments
I know it's an old Issue but i fixed it on my fork by modifying the local f = function(x)
local index = tonumber(x)
if index then
return tostring(vars[index])
else
return tostring(vars[x])
end
end and it works now: print(lume.format("{1} is {2} and {f}", {true, false, f=false}))
-- prints true is false and false it just prints nil in case of 'not found' now |
@ItsNMB Very nice if it works - I hope to check it in the couple of weeks. I still use Lua/LOVE/lume in hobby projects, so if your fix works, it will be useful to me :) And maybe your approach gave me an idea for an even cleaner fix ... hmm.. |
Hi, it's been a long time to verify and respond and yes, your approach fixes the issues with booleans. It makes 3 tests fail though. Maybe the tests should be adjusted. I'll probably use your approach in my fork as well, after I've fixed tests. |
Simple test:
I guess this is of the way Lua deals with false values, not sure what a proper fix would be, but if I can figure one out I will send a PR.
The text was updated successfully, but these errors were encountered: