Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
You can also use some sort of simplified state machine and use tables for states, if you have more complex conditions to check, helps with readability and convenience.
An engine controller would be a go-to example to make use of such a state machine, since an engine can only have a single state at any time (off, starting, idle, running, generator mode etc.) you'd set functions for each state in a table and go from there, instead of having tangled and intertwined nested if-statements.
First argument is the channel number, second one is required to be boolean (false/true), since lua does it differently than other languages and 0 is interpreted as true (or something among the lines).
And as Grumpy stated on/offs must be true or false but you can use an alias like I show below.
It only threw that error for the "~manMode" part. That iteration of the script, I know I no longer have a copy of.
[EDIT]
Here's a gently modified version of the script I tried to make layed out in logic gate format. I'll go back over it eventually and replace a lot of it with boolean function blocks (I keep forgetting those exist).
https://steamcommunity.com/sharedfiles/filedetails/?id=3058432293
[edit]
Well, I'll be danged.
https://www.lua.org/manual/5.3/manual.html