Forum

> > CS2D > Scripts > timer
Forums overviewCS2D overview Scripts overviewLog in to reply

English timer

5 replies
To the start Previous 1 Next To the start

old timer

vader
User Off Offline

Quote
i have a timer
1
timer(100,'antisp',id)
that start this function
1
2
3
function antisp(id)
antisp2[id]=antisp2[id]-1
end
there is error
LUA ERROR: sys/lua/my/scripts/chat.lua:83: attempt to perform arithmetic on field '?' (a nil value)
how fix that?


-----------------
thx timequest
-----------------
edited 2×, last 14.07.15 05:46:53 pm

old Re: timer

TimeQuesT
User Off Offline

Quote
The argument will be given as string. So you have to force it to be a number again.
1
2
3
4
function antisp(id)
	id = tonumber(id);
	antisp2[id] = antip2[id]-1;
end

old Re: timer

vader
User Off Offline

Quote
TimeQust,

1
id=math.tonumber(id)
LUA ERROR: sys/lua/my/scripts/chat.lua:78: attempt to call field 'tonumber' (a nil value)

old Re: timer

TimeQuesT
User Off Offline

Quote
It is in the global namespace. I have no idea why you looked it up in the math ones.

1
id = tonumber(id);
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview