Difference between revisions of "An Introduction to Scripting with LUA"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Basic Syntax (▲))
m (Text replacement - "wikitable" to "ts")
 
(4 intermediate revisions by 2 users not shown)
Line 4: Line 4:
 
== Basic Syntax ([[#top|<b>▲</b>]]) ==
 
== Basic Syntax ([[#top|<b>▲</b>]]) ==
  
{| class="wikitable mw-collapsible" style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%"
+
{| class="ts mw-collapsible" style="background: #f0f0f0" width="100%"
 
|-
 
|-
! colspan="2" | <b>Basic Commands</b>
+
! colspan="2" | <b>Types</b>
 +
|-
 +
| <b>integer</b> || an integer is a <span style="color:#CD8C95">number</span> value
 +
|-
 +
| <b>boolean</b> || a boolean is a value which equals <span style="color:#cdad00">true</span> or <span style="color:#cdad00">false</span>
 +
|-
 +
| <span style="color:blue"><b>string</b></span> || a <span style="color:blue">string</span> is a text message <span style="color:#FF8C69">"wrapped in quotation marks"</span> or <span style="color:#FF8C69">'apostrophes'</span>
 +
|-
 +
| Example || Example
 +
|-
 +
| Example || Example
 +
|}
 +
 
 +
{| class="ts mw-collapsible" style="background: #f0f0f0" width="100%"
 +
|-
 +
! colspan="2" | <b>Operators</b>
 
|-
 
|-
 
| <span style="color:#cdad00"><b>if</b></span> || <b>allows us to query if something: equals, does not equal, is less/more than x value etc ...</b>
 
| <span style="color:#cdad00"><b>if</b></span> || <b>allows us to query if something: equals, does not equal, is less/more than x value etc ...</b>
Line 17: Line 32:
 
if condition == false then -- this is also valid for checking if a (boolean) condition equals false!
 
if condition == false then -- this is also valid for checking if a (boolean) condition equals false!
 
</syntaxhighlight>
 
</syntaxhighlight>
|-
 
| Example || Example
 
|-
 
| Example || Example
 
|-
 
| Example || Example
 
|-
 
| Example || Example
 
|-
 
| Example || Example
 
|-
 
| Example || Example
 
 
|-
 
|-
 
| Example || Example
 
| Example || Example
Line 36: Line 39:
 
| Example || Example
 
| Example || Example
 
|}
 
|}
{{i18n|Manual}}
+
 
 +
<syntaxhighlight>
 +
bool
 +
boolean
 +
true
 +
false
 +
integer 1, 2
 +
string "hello!"
 +
</syntaxhighlight>

Latest revision as of 19:35, 19 August 2014

I have decided to write an introduction into the basics of LUA Script; so that you can get a better understanding of how it works & how you can apply it within the Visionaire Studio™ editor, to further enhance your games!

Basic Syntax ()

Types
integer an integer is a number value
boolean a boolean is a value which equals true or false
string a string is a text message "wrapped in quotation marks" or 'apostrophes'
Example Example
Example Example
Operators
if allows us to query if something: equals, does not equal, is less/more than x value etc ...
if condition then -- this queries if (boolean) condition equals true then do some action!
if condition == true then -- this is also a valid way for seeing if a (boolean) condition equals true!
if not condition then -- this checks if (boolean) condition equals false!
if condition == false then -- this is also valid for checking if a (boolean) condition equals false!
Example Example
Example Example
Example Example
bool
boolean
true
false
integer 1, 2
string "hello!"