996
edits
m (mostly wording) |
m (finished setup part, except the text editor list) |
||
Line 19:
While you may be tempted to start writing code right away you'll need to set up an environment for this first. This is what's called a '''development environment'''.
As you'll just be writing some basic [https://luau-lang.org luau] (a dialect of the [https://lua.org/ lua]) throughout this tutorial, this will consist of just a '''text editor''' (and something to run your code with). A text editor can be as simple as just a notepad program so you have somewhere to jot down your code, or can be more complex and specialized for writing code. These types of text editors (code editors) often offer useful features such as automatic code completion and syntax highlighting (it colour-codes smaller bits of code, conveying their meaning or data type). A few suggestions for a code editor are listed below, complete with pros, cons, images, and links.
* (the list)
Line 26:
Once you've set up a code editor, there's one more thing to do before you can start coding: setting up a '''runtime environment'''. As lua is a '''scripting''' language - a programming language in which the instructions to the computer are stored as '''source code''' (the code as you wrote it, in textual format) - it must be translated to the computer in real time because computers can only understand binary (0s and 1s). This is what a runtime environment is for (in this case); it allows for the execution of '''scripts''' (source code) by translating them to '''machine code''' (instructions understandable to the computer) on the go.
In this case, you'll need something that can run luau code. This guide recommends that you use Roblox Studio for these purposes. Using Studio to test your code isn't exactly the best, but studio is approachable for a beginner such as yourself. Besides, there aren't really any other options anyways.
For now, do the following:
* Install Roblox Studio if necessary.
** Go to https://create.roblox.com/
** Click the 'Studio' button in the left side menu (under 'Quick links': at the bottom of the list). Alternatively, if you are not logged in, click the 'Start creating' button.
** Click the 'Download' button
** Install Studio by running the newly downloaded file
* Open Roblox studio and under the 'New' tab click on the 'Baseplate' template
* Open the file tab (Top left) and save this new experience (click 'Save to Roblox')
* Close all of the windows except the 'Output' window (if present) and the 'Explorer' window.
** If you don't have an output window, click the 'View' tab at the top of your screen and then click the 'Output' button to turn the window on
* Resize the output window to be a bit bigger than by default if you have the screen space for it.
* In the Explorer, hover over the 'ServerScriptService' and click the plus (+) icon beside it. Then, add a script to it (a regular script: make sure it's not a LocalScript or ModuleScript).
If you've done everything correctly, you should now be in the built-in script editor. You should see the following:<syntaxhighlight lang="lua" line="1">
print("Hello world!")
</syntaxhighlight>
Go ahead and run this by clicking play at the top of your screen. You'll do this from now anytime you need to run your code. Unless you've chosen the built-in studio editor as your text editor of choice, you'll have to copy and paste the code you write into this script. Make sure to first select all of the text and only then paste your code so as to replace the existing contents.
Once everything's loaded, you should see the following in the output window:
Hello world!
This means everything's working! You're now ready to start coding. If this isn't the case, double check you followed all of the instructions to the letter.
- Use this as an introduction to basic code flow
|