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

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "<div id="top"</div> 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 wi...")
 
m (Text replacement - "wikitable" to "ts")
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<div id="top"</div>
+
<div id="top"></div>
 
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!
 
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 ([[#top|<b>▲</b>]]) ==
 
== Basic Syntax ([[#top|<b>▲</b>]]) ==
  
{| style="background: #f0f0f0; border: 1px dashed darkgrey" width="100%"
+
{| class="ts mw-collapsible" style="background: #f0f0f0" width="100%"
 
|-
 
|-
! <b>Syntax</b> !! <b>Description</b>
+
! colspan="2" | <b>Types</b>
 
|-
 
|-
| <span style="color:blue">if</span> || allows us to query if something: equals, does not equal, is less/more than x value etc ...
+
| <b>integer</b> || an integer is a <span style="color:#CD8C95">number</span> value
 
|-
 
|-
| Example || Example
+
| <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
 
|-
 
|-
 
| Example || Example
 
| Example || Example
 +
|}
 +
 +
{| class="ts mw-collapsible" style="background: #f0f0f0" width="100%"
 
|-
 
|-
| Example || Example
+
! colspan="2" | <b>Operators</b>
 
|-
 
|-
| Example || Example
+
| <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>
 
|-
 
|-
| Example || Example
+
| colspan="2" |
 +
<syntaxhighlight>
 +
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!
 +
</syntaxhighlight>
 
|-
 
|-
 
| Example || Example
 
| Example || Example
Line 29: Line 40:
 
|}
 
|}
  
{{i18n|Manual}}
+
<syntaxhighlight>
 +
bool
 +
boolean
 +
true
 +
false
 +
integer 1, 2
 +
string "hello!"
 +
</syntaxhighlight>

Latest revision as of 18: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!"