Log In  

how many tokens should this cart cost?

s="x".."="
a=1+2

in 0.2.1b, it costs 10 tokens (5 for each line). this seems correct to me. however, in 0.2.5e, the first line only costs 4 tokens for some reason.

edit: even weirder: s="x".."=" costs 4 tokens but s="x".."y" costs 5 tokens. it seems like concatenating any string that starts with the equals symbol is 1 token cheaper than it should be; how odd! maybe this is somehow due to the recent parser updates for += etc?

P#123586 2023-01-03 07:52

1

Yup, and it doesn't require an assignment either. Granted these aren't actually functional code, but the token counting is nevertheless correct when the string doesn't start with "=":

{"x".."="} -- 3 tokens
{"x".."y"} -- 4 tokens

I'm guessing it's a glitch in the ..= operator detection. Changing to other operators doesn't seem to exhibit the same problem, though I didn't test all of them.

It might be to do with the fact that "." is a very overloaded character in Lua's grammar.

P#123837 2023-01-06 17:12 ( Edited 2023-01-06 18:30)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 20:43:00 | 0.005s | Q:9