picotool
picotool copied to clipboard
Parser should accept Lua paren-less function calls with a single string or table literal
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.
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!)
@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
a end do b{c=1} a sspr
Ah... my bad (explains why I never thought it was an issue 🤦♂️) *HidesInShame* 🙈