Hey, I haven't been scripting in GLua for a while so forgive me if I look like an idiot.
I've been trying to use
[lua]
timer.Simple(1, self.ActuallyCreatePortal, self)
[/lua]
in my code, and "Attempt to index local 'self' (nil value)" Shows up in console. This happens for any timer.Simple I try to use.
So, I'm wondering, has Garry removed the timer.Simple functionality?
No Garry did not remove timer.Simple. Whether or not he changed how they are used I am not sure. Here try this instead:
[code]
timer.Simple(1, function()
self.ActuallyCreatePortal
end)
[/code]
Actually try this....
[code]timer.simple(1, function() self.ActuallyCreatePortal() end)[/code]
He forgot one thing. ^^
Thanks :p
[QUOTE=Aaron113;41015480]Actually try this....
[code]timer.simple(1, function() self.ActuallyCreatePortal() end)[/code]
He forgot one thing. ^^[/QUOTE]
[lua]timer.Simple(1, function() self:ActuallyCreatePortal() end)[/lua]
[QUOTE=Wizard of Ass;41018735][lua]timer.simple(1, function() self:ActuallyCreatePortal() end)[/lua][/QUOTE]
[LUA]timer.Simple(1, function() self:ActuallyCreatePortal() end)[/LUA]
Oh, I copy pasted the above code and the S seemed correct :v:
I'm having the same problem I can't get my timer to work either:
[code]timer.Simple(20, function() self:map_changing() end)[/code]
Based off what I read here but it doesn't do anything. Here's my function:
[code]function map_changing()
end[/code]
[QUOTE=Caratt;41023174]I'm having the same problem I can't get my timer to work either:
[code]timer.Simple(20, function() self:map_changing() end)[/code]
Based off what I read here but it doesn't do anything. Here's my function:
[code]function map_changing()
end[/code][/QUOTE]
[lua]timer.Simple(20, function() map_changing() end)[/lua]
I'll try it I've tried so many different methods to get it to work and not having any luck today.
[QUOTE=Caratt;41023258]I'll try it I've tried so many different methods to get it to work and not having any luck today.[/QUOTE]
There's only one way, because of the syntax...
This worked before the latest update:
[code]timer.Simple(20, map_changing)[/code]
[QUOTE=Caratt;41023323]This worked before the latest update:
[code]timer.Simple(20, map_changing)[/code][/QUOTE]
LOL, that was way back for GMOD12.
Here's all the changes since you don't seem to know about them.
[URL="https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit"]https://docs.google.com/document/d/1khSuIYrAMkqXu7wlH5YRJNwz6hOH6Xqi5lqBhE3x6gA/edit[/URL]
brandonj4 I'm not kidding before the latest update that code worked perfectly fine.
The second argument to timer.Simple is a function.
[code]timer.Simple(20, function() map_changing() end)[/code] and [code]timer.Simple(20, map_changing)[/code] will each have the same outcome.
The change with timer.Simple is that you can no longer pass arguments directly to the function that the timer module calls, map_changing is an argument-less function so this is no issue.
Funny how simple questions seem to take a few posts to finally get the right answer. Happened both times and I've seen it plenty of times before.
It's caused by what seems to be general misunderstanding that quite a lot of people around here seem to have and I believe it creates a problem for new (or any) developers with questions
Well, my timer problem is fixed, thanks guys.
Sorry, you need to Log In to post a reply to this thread.