|
| 1 | +--- |
| 2 | +sidebar_position: 1 |
| 3 | +--- |
| 4 | + |
| 5 | +# Basics of scripting in ROBLOX Studio and TRIA.os |
| 6 | + |
| 7 | +Welcome to the scripting documentation of TRIA.os!<br></br> |
| 8 | +By default we assume you have some knowledge of general scripting in ROBLOX Studio so the documents will sound a bit nerdy, but if you don't have the neccessary information, you can consult this page. |
| 9 | + |
| 10 | +## Booleans |
| 11 | + |
| 12 | +Boolean is an easy-to-understand data type which one has two values: `true` or `false`. Think of it like a light switch, there are only two states a light bulb can be which is on or off.<br></br> |
| 13 | +In [conditional statements](https://create.roblox.com/docs/scripting/luau/control-structures#if-statements), if a boolean isn't `false` or `nil`, Luau (the scripting language used for Studio) will assume the boolean as `true`.<br></br> |
| 14 | + |
| 15 | +## Strings |
| 16 | + |
| 17 | +String is a data type used to store text data, such as letters, numbers and symbols.<br></br> |
| 18 | +To declare a string, type out anything you want and then wrap that thing in double quotes (`"`) or single quotes (`'`).<br></br> |
| 19 | +`Example:`<br></br> |
| 20 | +```lua |
| 21 | +message = "Hello world!" |
| 22 | +``` |
| 23 | +Combining (or concatenating) strings is quite simple, add two periods (`..`) between those strings. Concatenating strings won't insert a space between them so you'll have to put one yourself at the end of the first string and beginning of the next string or concatenate a space (`" "`) between the strings.<br></br> |
| 24 | +`Example:`<br></br> |
| 25 | +```lua |
| 26 | +message1 = "Hello" |
| 27 | +message2 = "world!" |
| 28 | +message2WithSpaceAtTheBeginning = " world!" |
| 29 | +print(message1 .. " " .. message2) -- Hello world! |
| 30 | +print(message1 .. message2WithSpaceAtTheBeginning) -- Hello world! |
| 31 | +print(message1 .. message2) -- Helloworld! (this is not a typo) |
| 32 | +``` |
| 33 | + |
| 34 | +## Tables |
| 35 | + |
| 36 | +Tables are used to store multiple types of data that isn't `nil` (which is nothing) such as booleans, numbers, strings, functions,...<br></br> |
| 37 | +You can declare a table by curly braces (`{}`). |
| 38 | +`Example:`<br></br> |
| 39 | +```lua |
| 40 | +table1 = {} -- creates an empty table |
| 41 | +print(table1) -- {} |
| 42 | +``` |
| 43 | +Tables can be used as arrays or dictionaries. Arrays use numbered lists for indexing data; dictionaries can have numbers, strings, objects as indices. |
0 commit comments