Difference between revisions of "Basic lua: Introduction"

From The Official Visionaire Studio: Adventure Game Engine Wiki
(Created page with "== What is Lua Script == '''Lua Script''' is a lightweight cross-platform scripting language that was originally created as an extension of sorts, to further extend upon alrea...")
 
Line 1: Line 1:
 
== What is Lua Script ==
 
== What is Lua Script ==
'''Lua Script''' is a lightweight cross-platform scripting language that was originally created as an extension of sorts, to further extend upon already existing programming languages, but over time, it has grown in popularity due to how easy it is to learn, & the amount of time saved in creating simple functions & tables etc.
+
'''Lua Script''' is a lightweight, cross-platform scripting language that was originally created as an extension of sorts, to further extend upon already existing programming languages, but over time, it has grown in popularity due to how easy it is to learn, & the amount of time saved in creating simple procedural scripts, functions & tables etc...
  
Lua script is now the primary or secondary language of a lot of game engines, besides being used in various applications & web design.
+
...thus Lua script is now the ''primary'' or ''secondary'' scripting language of multiple game engines. It is also used in various applications & web design.
  
 
== What is the meaning of LUA ==
 
== What is the meaning of LUA ==
Actually it's not <strike>''LUA''</strike> at all. Lua is not an abbreviation or acronym of any kind, it is actually the ''Portuguese'' word for '''moon'''.
+
Actually it's not <strike>''LUA''</strike> at all. Lua is '''not''' an ''abbreviation'' or ''acronym'' of any kind, it is simply the ''Portuguese'' word for '''moon'''.
 +
 
 +
== What languages is Lua similar to ==
 +
Lua, is similar to programming languages such as C, C#, C++, & Java to name a few, although Lua is relatively basic in comparison. The similarities are based on the structure of the languages & the way that they are written out - ''well for me anyway''.
 +
 
 +
== The basics ==
 +
=== Print ===
 +
The print function is used for printing messages to the log file or lua console & is useful for debugging your scripts & functions.
 +
<syntaxhighlight>
 +
print("hello world") -- prints "hello world" into the log/console (ah yes how cliché of me, but it had to be done)
 +
</syntaxhighlight>
 +
=== Concatenation ===
 +
Concatenation is essentially the joining of 2 or more strings.
 +
<syntaxhighlight>
 +
a = "hello"
 +
b = "world"
 +
 
 +
print(a .. " " .. b) -- prints "hello world" we had to add " " to create a space between the 2 words
 +
</syntaxhighlight>

Revision as of 13:05, 22 September 2014

What is Lua Script

Lua Script is a lightweight, cross-platform scripting language that was originally created as an extension of sorts, to further extend upon already existing programming languages, but over time, it has grown in popularity due to how easy it is to learn, & the amount of time saved in creating simple procedural scripts, functions & tables etc...

...thus Lua script is now the primary or secondary scripting language of multiple game engines. It is also used in various applications & web design.

What is the meaning of LUA

Actually it's not LUA at all. Lua is not an abbreviation or acronym of any kind, it is simply the Portuguese word for moon.

What languages is Lua similar to

Lua, is similar to programming languages such as C, C#, C++, & Java to name a few, although Lua is relatively basic in comparison. The similarities are based on the structure of the languages & the way that they are written out - well for me anyway.

The basics

Print

The print function is used for printing messages to the log file or lua console & is useful for debugging your scripts & functions.

print("hello world") -- prints "hello world" into the log/console (ah yes how cliché of me, but it had to be done)

Concatenation

Concatenation is essentially the joining of 2 or more strings.

a = "hello"
b = "world"

print(a .. " " .. b) -- prints "hello world" we had to add " " to create a space between the 2 words