What's the difference: GLua & Lua

What’s the difference between GLua and Lua? I always assume it’s just normal lua when I hear people talking about it. What is the difference?

I’m assuming you know this part already but GLua = Garry’s Mod Lua.
To me GLua refers to everything that makes up the scriptable side of Garry’s Mod (think SWEPs/gamemodes/entities and all their relevant functions, the in-built libraries like draw, sound, vgui, etc.) as well as the actual changes to the Lua language that the dev team made such as adding the “continue” keyword, the C style comments and the “&&”, “||” and “!”/"!=" aliases for “and”, “or” and “~”/~=".
If someone knows Lua but has 0 experience with GLua you probably wouldn’t hire them for a Garry’s Mod job as they’d have a lot to learn.

As with any game-specific scripting, they’d need to learn the libraries, but the most notable difference is the operators used for both assignment and comparison.

What operators are different for assignment?

This covers a few of the changes and shows some examples:
https://dl.dropboxusercontent.com/u/26074909/tutoring/_tutorial_quizzes/_coding_standards.lua.html

break and continue are very helpful in preventing the need to iterate through useless data, or preventing us from having to build a nest of indented if statements of what we are looking for instead of just continuing on things we aren’t looking for.

[lua]
//
// Coding Standards - Josh ‘Acecool’ Moser
//
[/lua]

God help us all

In terms of core functionality, GLua adds C operators, continue [del]and break[/del], and everything is based clientside, serverside, or shared.

Break is core Lua.

I updated a few more of the examples. Yes, the Coding Standards doc is one of “MANY” which will be a part of the Lua class I’ll be releasing soon ( a bunch of examples, documentation for anyone and everyone to look at, learn at their own pace, etc… )…

My standards are NOT the only one, and people will NOT be forced to use any ONE format.

My class covers real-world scenarios which people may encounter, such as working for different companies where a coding standard must be followed, VS working for yourself or creating a brand-new thing whereby you can use your own standard, VS updating Garry’s Mod Lua on Git and following that standard. It won’t stop at 3.

I will not be “officially grading” work done, but I will be available to answer questions on the class. There are no “turn-in” assignments, all assignments are out there along with 1 to many solutions. People can turn in their own solutions to be linked to the main assignment in order to add to the collection of resources.

As said, all assignments, and solutions to those assignments will be there. No one will be forced to use my coding standard if they don’t want to, no one is forced to use the resources I’ll be putting out there; they’re there so people can learn. As said, it covers real-life scenarios which is why the standards will be there…

The assignments may be structured in such a way that says that X standard is being used for the entire project ( Of course, how the end-user decides to code it is up to them, if they want a challenge to see how well they can adapt to different coding standards they can try it out ), you must create a function which accepts x, y and z input and returns true or false, a or b, or whatever ( Just like in a team in the real-world where coding tasks are broken up after the core-design is completed, the overall design of the project is there so that many people can work on it at the same time on different things without breaking things ). For each “assignment” there may be several projects. Individually they may be helper-functions, collectively they will solve a problem or add a feature.

Anyways, OP if you need any help, feel free to add me.

Why do you feel the need to talk about your classes in half your posts? Literally nobody is asking any questions related to them yet you talk as if they do.

I was responding to Dear_Matt and anyone else that has animosity towards me because of my name ( A School ), or my coding standards. I’d rather not have to explain myself and I do ignore most of the posts but I feel the need to occasionally bring it up because I am trying to help without asking for anything in return…

Since people are going off topic… I wish we had assignment operators like *= += /= %= ^= etc… and the bitwise operators back, with their assignment operators. |= &=

People don’t mess with you because of your name (I didn’t know it meant “a school” before now though :v:) and most of the people here too help others without expecting anything in return.

It just seems obnoxious constantly mentioning one’s project(s) (in your case, your classes).

Frankly regarding posts like Dear_Matt’s I think that should be bannable.

I have missed those… Upvote it? https://github.com/Facepunch/garrysmod-requests/issues/309

As is continue.

Continue is not in standard Lua.

As of 5.2, there is goto



for k, v in pairs( x ) do
    if not condition then goto continue end
    ::continue::
end

If we LuaJit 2.0.1 or higher ( since iirc we are using 5.1 for Lua ) we can use that.

We are at LuaJIT 2.0.3

break; is, continue; is not. Garry added it:


8 – The Complete Syntax of Lua

Here is the complete syntax of Lua in extended BNF. (It does not describe operator precedences.)


	chunk ::= {stat [`;´]} [laststat [`;´]]

	block ::= chunk

	stat ::=  varlist `=´ explist | 
		 functioncall | 
		 do block end | 
		 while exp do block end | 
		 repeat block until exp | 
		 if exp then block {elseif exp then block} [else block] end | 
		 for Name `=´ exp `,´ exp [`,´ exp] do block end | 
		 for namelist in explist do block end | 
		 function funcname funcbody | 
		 local function Name funcbody | 
		 local namelist [`=´ explist] 

	laststat ::= return [explist] | break

	funcname ::= Name {`.´ Name} [`:´ Name]

	varlist ::= var {`,´ var}

	var ::=  Name | prefixexp `[´ exp `]´ | prefixexp `.´ Name 

	namelist ::= Name {`,´ Name}

	explist ::= {exp `,´} exp

	exp ::=  nil | false | true | Number | String | `...´ | function | 
		 prefixexp | tableconstructor | exp binop exp | unop exp 

	prefixexp ::= var | functioncall | `(´ exp `)´

	functioncall ::=  prefixexp args | prefixexp `:´ Name args 

	args ::=  `(´ [explist] `)´ | tableconstructor | String 

	function ::= function funcbody

	funcbody ::= `(´ [parlist] `)´ block end

	parlist ::= namelist [`,´ `...´] | `...´

	tableconstructor ::= `{´ [fieldlist] `}´

	fieldlist ::= field {fieldsep field} [fieldsep]

	field ::= `[´ exp `]´ `=´ exp | Name `=´ exp | exp

	fieldsep ::= `,´ | `;´

	binop ::= `+´ | `-´ | `*´ | `/´ | `^´ | `%´ | `..´ | 
		 `<´ | `&lt;=´ | `>´ | `&gt;=´ | `==´ | `~=´ | 
		 and | or

	unop ::= `-´ | not | `#´



Okay cool. I just didn’t know the difference between the two, and I am starting to use things like “!=, &&, ||”, etc, because I’m learning unity and it just seems good that I pretend it’s C#. Thanks guys!

Oh wow, Robot closed yet another suggestion without so much as a word… So – won’t work, the others will. Re-open it.