if/else statements in Lua.Run()?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
LostTrainDude
Posts: 74
Joined: Wed Mar 21, 2018 2:14 pm

if/else statements in Lua.Run()?

Post by LostTrainDude »

Hi Tony!

Is it possible to execute if/else statements in a Lua.Run() call?

I tried checking in the Lua Console if I could run something like "if Variable['myVar'] == 100 then Variable['myOtherVar'] = true" and "if (Variable['myVar'] == 100) Variable['myOtherVar'] = true" but to no avail.

No big deal if it's not possible, but if there was a way to do so I could greatly benefit it :)

Thanks in advance!
User avatar
Tony Li
Posts: 21962
Joined: Thu Jul 18, 2013 1:27 pm

Re: if/else statements in Lua.Run()?

Post by Tony Li »

Hi,

Yes, you can even send entire Lua programs to Lua.Run() if you want. Lua's if..then..end syntax is a little different from C#:

Code: Select all

if (Variable['myVar'] == 100) then Variable['myOtherVar'] = true end
Post Reply