Another guy trying to learn LUA

So hai.

Well i’ve been trying to learn LUA the past few days and what i decided to start with was to get somthing to work, so i found the old gmod wiki with all the lua tutorials, and one of them was “your first scripted SWEP”.
And i was like, Cool.
So i started going through it and doing just as it said.
So this is where my problem comes, when start up a map on gmod, and i go into console and type lua_openscript “chair_thrower.lua” and i get this as a response:

[lua\chair_thrower.lua:7] attempt to index global ‘SWEP’ (a nil value)

The weapon wont even load.

After trying to fix this for some time i got tierd of it and i copied the tutorial rigth off, guess what, same result.
so im thinking my gmod is either broke or im just horribly noobie and missed somthing very basic.

Oh yeah, also tried running it from lua/autorun/client but got the same results.

So any ideas my LUA gods?

Weapons doesn’t go in that folder.
And rename the file to shared.lua and put it in a folder called Chair_Thrower
That folder goes into lua/weapons
Your path will be lua/weapons/chair_thrower/shared.lua

Hey thanks alot man it worked!

You’re welcome :downs:

First step: Lua. Not LUA.

No it’s L.U.A.

Alrigth guys…it’s not that important for me, thanks for try to help out tho but the most important thing is that you make a helluva lot of cool stuff to help Garry’s mod evolve! :eng101:

No. It’s not L.U.A.
It’s Lua.
“Lua” (pronounced LOO-ah) means “Moon” in Portuguese. As such, it is neither an acronym nor an abbreviation, but a noun.

Yeah. For future reference by the way, I’ve found trying to openscript SWEPs/SENTs doesn’t work, they load into the spawn menu when the server restarts. So there’s a chance is you get a number of global errors the thing’s working fine, but won’t work with openscript.

Nah. It’s L.U.A.

[editline]25th February 2012[/editline]

I’m a L.U.A. coder.

[editline]25th February 2012[/editline]

Pronounced L.OO.-AH

You cant deny lua.org
It’s facts sir.

You do realise that he was joking because garry named this forum “L.U.A”, don’t you?

oyes melord

And here was I thinking nobody got it :v: