Page 1 of 1

self usable to evt_tables and others.

Posted: Sat Aug 12, 2017 11:58 am
by Bugala
So far I thought the usage of self is restricted only in evt_tables case, but now i noticed this same restriction is also when using SetInterval()

I can of course get around this problem using "userdata", but it does worry me a bit if it maybe gives me some hard to track problem at some point.

Hence to a wishlist a possibity to use self function in both evt_tables as well as setintervals and everywhere else too.

as example of how i want to be able to do is:

Code: Select all

SetInterval(1, MyFunction:SelfFunction, 100)

Re: self usable to evt_tables and others.

Posted: Tue Aug 15, 2017 8:38 pm
by airsoftsoftwair
Might be a useful addition. I'll think about it.

Re: self usable to evt_tables and others.

Posted: Tue Aug 15, 2017 11:16 pm
by Bugala
I believe it would result in more readable code, and current version could also result in need to make same function twice, for when using it for evt_table, you have to use it as table.function, instead of table:function, hence if you at some other point in code need to refer to that some function as table:function, that would mean you would need to make it twice, once for table.function and second for table:function, unless you manually add that userdata on that other call too, making code more messy again.

Re: self usable to evt_tables and others.

Posted: Wed Sep 18, 2019 12:45 pm
by Bugala
I figured a way to get around when using setinterval:

Code: Select all

setinterval(1, function () MyFunction:SelfFunction endfunction, 100