Page 1 of 1

if/else statements in Lua.Run()?

Posted: Fri Oct 21, 2022 4:36 am
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!

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

Posted: Fri Oct 21, 2022 8:12 am
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