Stack traceback error

I’m brand new to LUA, so I’m trying to code a simple RP wallhack that shows all entities.

Code:
[lua]local active = false
hook.Add(“PreDrawOpaqueRenderables”,“Drawstuff”,function()
if active then
active = false
else
active = true
end
end)
concommand.Add(“tuskan_toggle”,function()
if active then
local entities = ents.GetAll()
for _,ent in pairs(entities) do
ent:DrawModel()
end
end
end)[/lua]

Error (From codepad.org)

line 2: attempt to index global ‘hook’ (a nil value)
stack traceback:
t.lua:2: in main chunk
[C]: ?

Sorry, this is probably a dumb thread, but I am brand new.

That website you are using, is using the basic Lua stuff. Garry’s Mod has extra functions, like hook.

Best to test is:
A: Get LuaPad, put it in your Add-Ons folder
B: Go in-game and test it.