Placing noFill without the () produces wrong error

When I mistakenly typed in noFill without the brackets the error came back with

‘=‘ expected near rectMode()

The code was

NoFill
rectMode(CENTER)

This was in V3 will test in 4

Edit : same error in V4, note you only need the noFill entry in both to see error.

That’s actually the correct error but it is confusing!

What Lua is expecting here is:

noFill = rectMode(CENTER)

(That is, it thinks you want to create a variable called noFill and assign to it the result of rectMode(CENTER))

But really the ideal error would be something like 'noFill' is not defined, did you mean to call 'noFill()'?

It would be cool to modify the Lua parser to handle this

Aaaah yes, didn’t consider that. Could be a big job re-coding that for the Lua parser. Does that only apply to Codea reserved words (beyond the Lua parser) ?

I have recently also seen issues like using reserved words like color as a variable which the parser colour coded but didn’t fire up an error.

You can basically redefine any Codea API as a variable if you want to, it just means you could lose access to the old one in your project.

For example:

noFill = 10
print(noFill) -- prints '10'