Tutorial 1: If statements, printing, and basic interaction. - GlassSources/airwiki GitHub Wiki

If statements, printing, and basic interaction.

So, in our first tutorial. We will be making a if statement on the version that is specified and then printing it. It's pretty basic, beginners please learn some Lua first for smooth coding.

Section 1:

Let's get setup with Air. You should have the Air model, and placed it into your Workspace. Then, click Workspace and view it's properties. Select LoadStringEnabled, and check the checkbox. After, that place a script anywhere; not a local script. After that, just go into your newly created script.

Section 2:

This section is starting to go to the meats of our tutorial.

Inside of the script, let's start by creating a if statement for the base of our tutorial.

Note: Replace "print("Hello world!")"

Your script show look like this now: if nil then end

Let's say if the version is at 1, it will print Hello, World! We can continue by reading the next section.

Section 3:

This should what you have right now, don't understand? Let me explain it.

if _G.rawAir.GetAPIVersion() == 1.0 then end

We made our if statement last section, and we added another segment replacing the nil.

We added the comparing section, and now it's comparing. If global variable rawAir and the function in the table of GetAPIVersion is at 1.0 then we stop.

Let's add the final part of our tutorial, the printing. Let's continue to the final section.

Section 4:

Let's add the print function in without the message yet.

if _G.rawAir.GetAPIVersion() == 1.0 then print() end

Our final touch is the parameter in print(). In which the args is message, and let's place a message now completing our tutorial.

if _G.rawAir.GetAPIVersion() == 1.0 then print("Hello, world!") end

Now, that concludes your very simple and beginner tutorial. Future tutorials are coming! Advanced coders, don't worry. I will be providing advanced lessons very soon!

Learn more at our AirDoc.

So much information, in just a couple of bytes. Learn more here.