Lua and GLua questions

My question are:

1)What version of Lua is GLua based on? I want to make sure I’m learning the correct version of vanilla Lua for GLua.

2)How much Lua should I learn before I get into GLua, I want to make sure I know vanilla Lua before I go into GLua, should I learn all of Lua? Or should I just learn a little.

As for question 2, I learned next to no vanilla lua. I knew Java when I started with gmod, and just read some of the lua documentation on syntax. If this is your first language though, I’d probably recommend looking more at lua.

Okay, thanks! I stopped learning java and I pretty much forgot how to code in it, so I’m going to learn vanilla Lua. But can anyone tell me what version I need to learn? I don’t want to learn a version of Lua that isn’t the version GLua is running. There could of been changes that might affect my coding later on.

I don’t know the answer to that, but I have to say, personally if it were me, I’d choose to go straight into GLua instead of fiddling with vanilla Lua. There is no advantage, that I see, for you to learn lua outside of gmod. All Lua code can run in gmod, and you have the advantage of being able to apply it directly to the game at the same time.

But that’s just me.

GLua is Lua 5.1 + LuaJIT ( Well techinally it’s only LuaJIT ), you can find out the jit version via lua print(jit.version) i think.

Thanks! I really needed that! Fortunately, I think the videos that I’m watching might be Lua 5.1 too, some of the things in the video don’t seem to be working for me, and I was using lua 5.2.

That and you mostly likely wouldn’t want to learn libraries such as io or anything else relating to how GLua handles user input/functions that are removed due to security reasons, also i think the operators are slightly modified if i remember correctly.
Of course a manual for vanilla Lua 5.1 would be useful so there you go http://www.lua.org/manual/5.1/, same goes for GMod’s wiki http://wiki.garrysmod.com/page/Main_Page.

My coding standards doc ( needs to be updated ) contains most of the changes between Lua and GLua: https://dl.dropboxusercontent.com/u/26074909/tutoring/_tutorial_quizzes/_coding_standards.lua.html

Base Lua doesn’t have continue, !, ||, &&, etc… It honestly doesn’t matter if you learn Lua or GLua first as long as you understand logic… For example, in Lua the way you’d create a “continue” in a for loop would be to use inverted logic in an if statement surrounding the contents that would be after the continue…

There are many benefits to knowing the rules of logic, knowing why it works, knowing how to invert it without changing the meaning, etc… If you’re in school I highly recommend taking Philosophy, Symbolic Logic, it’ll teach you that; I personally learn better and quicker on my own so you could read up on it.

Having all of the additions GLua provides is great, but if you want to use the same code in traditional Lua implementation you’d need to convert it back so there are upsides to using GLua vs traditional Lua; both work but what do you want out of it? I code in several languages so I write in a fairly standardized way across all languages I write in so it makes logic less tedious to transcribe…

I would highly suggest using SRCDS to create the code, it’s easy to set up: https://dl.dropboxusercontent.com/u/26074909/tutoring/server_srcds_steamcmd/setting_up_a_server_with_steamcmd.lua.html

If you write vgui ever, you’ll mess up and get stuck with an element on the screen that will only go away if you retry, or not… Here’s a console command I wrote which removes all vgui elements… clearvgui : https://dl.dropboxusercontent.com/u/26074909/tutoring/_utilities/concommand_clearvgui.lua

I have written over 400 tutorials and completed “systems” in Lua for Garry’s Mod. Here are some resources to help you get started:

Generalized Lua Help ( Links to Wikis, Answers the question of “Where do I post a simple question or DarkRP Specific question”, links to other resources compiled by forum members )
https://dl.dropboxusercontent.com/u/26074909/tutoring/___welcome_docs/_welcome_general_lua_learning.lua.html

Useful Programs ( SteamCMD, Autosizer, Desktops, Process Explorer ) and Notepad++ Upgrades
https://dl.dropboxusercontent.com/u/26074909/tutoring/___welcome_docs/_welcome_useful_programs_and_notepadpp_upgrades.lua.html