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

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
marche4ever
Posts: 20
Joined: Mon Jan 21, 2019 5:29 pm

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

Post 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
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Hi,

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

Code: Select all

Variable["foo"] = 42;  -- Comment: set foo to 42.
marche4ever
Posts: 20
Joined: Mon Jan 21, 2019 5:29 pm

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

Post by marche4ever »

that's super useful! thanks!
User avatar
Tony Li
Posts: 22049
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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.
Post Reply