Difference between revisions of "Basic lua: Index"

From The Official Visionaire Studio: Adventure Game Engine Wiki
Line 13: Line 13:
  
 
== Instructions ==
 
== Instructions ==
 
+
1. You need to download a suitable text editor capable of compiling lua script. I use [http://www.sublimetext.com Sublime Text].<br/>
# Numbered list item
+
2a. If you decided to use [http://www.sublimetext.com Sublime Text] then you will need to create a build script for lua, as it doesn't come with one.<br/>
# Numbered list item
+
2b. Open up [http://www.sublimetext.com Sublime Text] & go to: ''Tools > Build System > New Build System...''<br/>
 +
2c. A new tab should open up titled '''untitled.sublime-build'''.<br/>
 +
2d. Replace the code that is already in the tab with... (taken from [https://gist.github.com/rorydriscoll/1854656 lua.sublime-build] by [https://gist.github.com/rorydriscoll Rory Driscoll])
 +
<syntaxhighlight>
 +
{
 +
"cmd": ["lua", "$file"],
 +
"file_regex": "^lua: (...*?):([0-9]*):?([0-9]*)",
 +
"selector": "source.lua"
 +
}
 +
</syntaxhighlight>
 +
2e. Save the document as '''lua.sublime-build <br/>
 +
3. Set the build system to lua by going to: ''tools > Build System > lua''.<br/>
 +
4. Voila you can now use '''ctrl'''+'''B''' to run your scripts. (file must be saved with .lua extension before scripts can be compiled)

Revision as of 17:24, 21 August 2014

A'llo & welcome to AFRLme's guide to lua script; for code dummies & monkeys alike. Here, I will be explaining the general basic fundamentals of lua script, along with examples & images. If you are wanting to learn how to use lua script in combination with Visionaire Studio, then you need to check out the scripting, data structure, player commands, common commands & script index pages.

Before we begin, if you have not already done so, then you will need a text editor capable of compiling lua script. Please follow the instructions below, else skip to the index list & have fun learning.

Index

Contents
 

Instructions

1. You need to download a suitable text editor capable of compiling lua script. I use Sublime Text.
2a. If you decided to use Sublime Text then you will need to create a build script for lua, as it doesn't come with one.
2b. Open up Sublime Text & go to: Tools > Build System > New Build System...
2c. A new tab should open up titled untitled.sublime-build.
2d. Replace the code that is already in the tab with... (taken from lua.sublime-build by Rory Driscoll)

{
"cmd": ["lua", "$file"],
"file_regex": "^lua: (...*?):([0-9]*):?([0-9]*)",
"selector": "source.lua"
}

2e. Save the document as lua.sublime-build
3. Set the build system to lua by going to: tools > Build System > lua.
4. Voila you can now use ctrl+B to run your scripts. (file must be saved with .lua extension before scripts can be compiled)