New Lua Implementation
Monday, February 27, 2006I just wanted to let people know what's going on with GMod.. because it's been a while without an update and everyone assumes it's dead.. and I like to be a honest with you guys as I can.
We might be doing something awesome with Valve but they stopped responding to my emails - so I don't know whether that will go ahead.
Anyway, here's what's going on.
I've kind of started from scratch again. This doesn't mean huge changes like the jump from 7 to 8, it's just because I need to start from scratch to fix a lot of stuff that's wrong. The Lua implementation, localization, crazy text bugs. This really shouldn't take that long either since most of the process will be copy > paste > clean > improve.
The downside to this will be that a lot of the current Lua scripts won't work. The upside will be that the new Lua implementation is so awesome that you wouldn't want them to. This will all be meaningless to people that haven't played with GMod Lua - but if you do know GMod Lua you'll get a giant boner.
The big change is that entities, vectors, players, angles etc are now types. Here's an example file
This file creates 2 console commands that clients can use. They spawn a ragdoll or a prop. It's the same command that the current version of GMod uses to spawn stuff - except it's in Lua.
As you can see it makes everything a lot simpler. Here's what running the script looks like in game.
As you can see the trace function returns a table full of useful stuff.
Some kewl things to note:
Entities, Players, Angles and Vectors are actually types with methods (pseudo classes).
Players type is derived from Entities so you can treat it as an entity and call any entity method on it.
Vectors can now be added/subtracted/multiplied without special functions.
Angles now exist (they don't in the current Lua implementation).
Some C syntax is usable ( !, !=, //, /* */, ||, && ) but you can still use Lua syntax.
Traceline now takes a table and returns a table - instead of having 10 functions to accept data.
Turn your phone to view blog list