Forum

> > CS2D > Scripts > sethook - nil value?
Forums overviewCS2D overview Scripts overviewLog in to reply

English sethook - nil value?

2 replies
To the start Previous 1 Next To the start

old sethook - nil value?

Banaan
User Off Offline

Quote
Quite a while ago, I tried using the cs2d lua cmd sethook function. The result, however, was an error: attempt to call global 'sethook' (a nil value). I didn't pay a lot of attention to it then and worked around it.

Today, someone asked me about this very same problem, and I couldn't give an answer to this pretty simple question. So I wrote a little test script to try it out a little:
1
2
3
sethook ("second", 0)
addhook ("second", "func")
function func () print("...") end

Result:
1
LUA ERROR: sys/lua/test3.lua:1: attempt to call global 'sethook' (a nil value)


So am I doing something entirely wrong here, or are there other people with the same problem?

old Re: sethook - nil value?

Flacko
User Off Offline

Quote
Lol, it seems like sethook got fucked up in the last version.
Fortunately, there aren't many scripts that use it.

1
print(type(sethook))
Outputs "nil" instead of "function".

old Re: sethook - nil value?

GreenDevil
User Off Offline

Quote
LOL and i though i could use it for my rtd script Aww man how much time do i need to wait so that i can use it!
Because i want to make a timer ! Disabled > 5 sec > Enabled
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview