Syntax incorrectly erroring

When I copy the code on line 710, which is valid code and does not error when run, then paste it on another line, studio will say it’s invalid code even though it is valid and will run. When I try to run this code, it will error on line 712, not on line 710 even though they are identical lines of code


image

This is intended behavior from Lua. The code is ambiguous, consider the following:

a = b
(c)(d)

What does this code mean? a = b(c)(d), or a = b, then c(d)? Since Lua doesn’t treat whitespace as a separator, you’d need to insert a semicolon after b to disambiguate.

5 Likes

Semicolon at the end did fix it

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.