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
Lua allows parentheses to be omitted from a function call if there is exactly one argument and the argument is a string or table literal. picotool does not yet support this case. PICO-8 supports it and offers a one-token discount compared to a similar call with parentheses.
function foo(arg) ... end
foo"single string argument"
foo{a=1, b=2, c=3}
I'm not sure how important this is to support, but I'm creating an issue for it just so we can track it. Upvotes and feedback welcome.
The text was updated successfully, but these errors were encountered:
Alas, I do rely on this trick quite a lot in my luamin-ified code quite a lot (every token counts!)
So, I would definitely be keen on this being supported.
FWIW, I thought it already did (as it seems I'm only using the string param method so far, and the minified output seems to preserve it... so far!)
dansanderson
changed the title
Accept Lua paren-less function calls with a single string or table literal
Parser should accept Lua paren-less function calls with a single string or table literal
Sep 11, 2021
@Liquidream It works fine with luamin! This bug is specific to the Lua parser. luamin operates directly on the token stream and doesn't use the parser.
blurble end do blah{x=1} blurble sspr
isn't valid Lua but luamin is happy to minify that to
Lua allows parentheses to be omitted from a function call if there is exactly one argument and the argument is a string or table literal. picotool does not yet support this case. PICO-8 supports it and offers a one-token discount compared to a similar call with parentheses.
I'm not sure how important this is to support, but I'm creating an issue for it just so we can track it. Upvotes and feedback welcome.
The text was updated successfully, but these errors were encountered: