Difference between revisions of "Basic lua: Index"
(13 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | 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 | + | {| class="in" |
+ | |- | ||
+ | | class="i_arrow clickablecell" | < | ||
+ | | class="i_norm clickablecell" | '''Index''' | ||
+ | | class="i_arrow clickablecell" | [[basic_lua:_Introduction|>]] | ||
+ | |} | ||
+ | <hr> | ||
+ | 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 [[Scripting|scripting]], [[Data_Structure|data structure]], [[Player_Commands|player commands]], [[Common_Commands|common commands]], [[Compiled_Index_of_Lua_Scripts_for_Visionaire_Studio|script index]], & also the official Visionaire Studio [https://www.visionaire-studio.com/luadocs/ luadocs] page. | ||
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|instructions]] below, else skip to the [[#Index|index]] list & have fun learning. | 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|instructions]] below, else skip to the [[#Index|index]] list & have fun learning. | ||
Line 20: | Line 27: | ||
|- | |- | ||
| class="cent" | 5 || [[Basic_lua:_Tables|Tables]] || Tables are one of the most fundamental features of Lua script. | | class="cent" | 5 || [[Basic_lua:_Tables|Tables]] || Tables are one of the most fundamental features of Lua script. | ||
+ | |- | ||
+ | | class="cent" | 6 || [[Basic_lua:_Functions|Functions]] || Functions are used to process & return data. They are also great for reducing workload & increasing workflow. | ||
|} | |} | ||
== Instructions == | == Instructions == | ||
+ | |||
+ | {| class="ts" | ||
+ | |- | ||
+ | | ''Quick note: this section is actually optional & is only for if you want to follow along with what is being shown on the pages of this guide; alternatively you could actually follow along via the script section of Visionaire Studio - it's just that I'm a bit of a snob & I like to type up my scripts in sublime text.'' | ||
+ | |} | ||
+ | <hr> | ||
1. You need to download a suitable text editor capable of compiling Lua script. I use [http://www.sublimetext.com Sublime Text].<br/> | 1. You need to download a suitable text editor capable of compiling Lua script. I use [http://www.sublimetext.com Sublime Text].<br/> | ||
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/> | 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/> | ||
Line 28: | Line 43: | ||
2c. A new tab should open up titled '''untitled.sublime-build'''.<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]) | 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> | + | <syntaxhighlight lang="text"> |
{ | { | ||
"cmd": ["lua", "$file"], | "cmd": ["lua", "$file"], | ||
Line 38: | Line 53: | ||
3. Set the build system to lua by going to: ''Tools > Build System > lua''.<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. (documents must be saved with '''.lua''' extension before scripts can be compiled) | 4. Voila you can now use '''ctrl'''+'''b''' to run your scripts. (documents must be saved with '''.lua''' extension before scripts can be compiled) | ||
+ | <hr> | ||
+ | {| class="ts" | ||
+ | |- | ||
+ | | ''Quick note: the screenshots I have included in this guide belong to the [https://atom.io/ atom] text editor by [https://github.com/ github] because I didn't want to include all the millions of tabs I have open in sublime text; also atom is 100% free.'' | ||
+ | |} | ||
+ | <hr> | ||
+ | {| class="in" | ||
+ | |- | ||
+ | | class="i_arrow clickablecell" | < | ||
+ | | class="i_norm clickablecell" | '''Index''' | ||
+ | | class="i_arrow clickablecell" | [[basic_lua:_Introduction|>]] | ||
+ | |}{{toc}} |
Latest revision as of 01:56, 4 September 2022
< | Index | > |
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 scripting, data structure, player commands, common commands, script index, & also the official Visionaire Studio luadocs page.
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 | Description |
---|---|---|
0 | Index | This page... |
1 | Introduction | Quick overview of Lua script, with some additional notes. |
2 | Basics | The basic fundamentals of Lua script. |
3 | Operators | Lua operators are expressions used to perform calculations or to pass arguments between different value types. |
4 | Types | Lua types can range from numbers, to strings, to tables, to conditions & even functions. |
5 | Tables | Tables are one of the most fundamental features of Lua script. |
6 | Functions | Functions are used to process & return data. They are also great for reducing workload & increasing workflow. |
Instructions
Quick note: this section is actually optional & is only for if you want to follow along with what is being shown on the pages of this guide; alternatively you could actually follow along via the script section of Visionaire Studio - it's just that I'm a bit of a snob & I like to type up my scripts in sublime text. |
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. (documents must be saved with .lua extension before scripts can be compiled)
Quick note: the screenshots I have included in this guide belong to the atom text editor by github because I didn't want to include all the millions of tabs I have open in sublime text; also atom is 100% free. |
< | Index | > |