English Anonymous functions icon

2 comments
04.01.12 04:42:13 pm
like 1 likes it!
2 kb, 70 Downloads
Banaan
User
Offline Off
For the few who hate not being able to hook local or anonymous functions to actions or timers, I wrote this little script.

It doesn't do anything cool, you don't get awesome admin powers or way too many images or npc's or whatever it is you lot like so much, it only makes scripting a little easier for a few of you.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
local function lolz(id, txt)
     msg(player(id, "name") .. " wrote: " .. txt)
end

addhook("say", "lolz") -- works
addhook("say", lolz, 3) -- works
addhook("say", function(...) lolz(...) end) -- works

freehook("say", "lolz") -- works
freehook("say", lolz) -- same
freehook("say", function(...) lolz(...) end) -- can't work because it creates a new function

timer(1000, "lolz")
timer(1000, lolz)
timer(1000, function(p) print(p) end, "hi", 2) -- works


None of the above would work normally (try it), now it does.
image
ok This file has been reviewed and approved by Fraizeraust (25.07.16 05:03:33 pm)

Comments

2 comments
Goto Page
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in
04.01.12 05:24:02 pm
like I like it!
Up
Kel9290
User
Offline Off
lolwut? Not think i need it but o:.
Spoiler >
edited 1×, last 05.01.12 01:50:52 pm
04.01.12 05:17:48 pm
Up
sheeL
User
Offline Off
Good lua!
edited 1×, last 20.07.14 07:43:33 am
To the start Previous 1 Next To the start