Basic lua: Operators: Difference between revisions
From The Official Visionaire Studio: Adventure Game Engine Wiki
Created page with "ghjgjg" |
No edit summary |
||
| Line 1: | Line 1: | ||
Lua operators are expressions used to perform calculations or to pass arguments between different value types. | |||
_NOTOC_ | |||
== Conditional Operators == | |||
{| class="tbl-ds" | |||
|- | |||
| <span class="blue bold">if</span> || width="90%" | Query if something does or does not meet a certain condition | |||
|- | |||
| <span class="blue bold">else</span> || Do something else if the query condition was not met | |||
|- | |||
| <span class="blue bold">elseif</span> || Used to add additional if queries, if the initial query condition was not met | |||
|- | |||
| <span class="blue bold">end</span> || This is used to close various queries or functions; there must be the same amount of <span class="blue">end</span> as <span class="blue">if</span> unless <span class="blue">elseif</span> has been used | |||
|} <br/> | |||
Example 1: if <span class="blue">condition</span> was met... | |||
{| class="tbl-alt" | |||
|- | |||
| <syntaxhighlight> | |||
local a = true | |||
if a then | |||
print("a = true") | |||
else | |||
print("a = false") | |||
end | |||
</syntaxhighlight> || width="200px" | [[File:lua_basics_001.png|thumb|right|180px|click to enlarge]] | |||
|} | |||
Revision as of 23:28, 18 August 2014
Lua operators are expressions used to perform calculations or to pass arguments between different value types. _NOTOC_
Conditional Operators
| if | Query if something does or does not meet a certain condition |
| else | Do something else if the query condition was not met |
| elseif | Used to add additional if queries, if the initial query condition was not met |
| end | This is used to close various queries or functions; there must be the same amount of end as if unless elseif has been used |
Example 1: if condition was met...
local a = true
if a then
print("a = true")
else
print("a = false")
end |
