Page 1 of 1

How do I make Lua.Run() ignore commented lines?

Posted: Fri Feb 05, 2021 8:24 pm
by marche4ever
I noticed myself tweaking inspector lua fields alot, sometimes I just need to temporarily comment out some lua lines to do a quick test (using double slash '//'), then remove the double slash so the code would register again. But Lua.Run() doesn't seem to handle this behaviour, so I have been copying the lua code to some where else, then paste it back afterwards. I wonder are

Re: How do I make Lua.Run() ignore commented lines?

Posted: Fri Feb 05, 2021 11:48 pm
by Tony Li
Hi,

In Lua, use '--' instead of '//'. Example:

Code: Select all

Variable["foo"] = 42;  -- Comment: set foo to 42.

Re: How do I make Lua.Run() ignore commented lines?

Posted: Sat Feb 06, 2021 6:03 pm
by marche4ever
that's super useful! thanks!

Re: How do I make Lua.Run() ignore commented lines?

Posted: Sat Feb 06, 2021 8:40 pm
by Tony Li
Glad to help!

Somewhat unrelated: You can also use C# style // comments in Sequence fields:

Code: Select all

Camera(Closeup);  // Cut to a closeup of the speaker.
Camera(Wide,,3);  // Then zoom out to a wide shot over 3 seconds.