Is it possible to use self in evt_table functions?

Discuss any general programming issues here
Post Reply
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Is it possible to use self in evt_table functions?

Post by Bugala »

This isnt the only situation where I have encountered this problem, but just as example.

Suppose I am making a button, so i make:

Code: Select all

makebutton(1, #LAYERBUTTON, "brushname", false, false, evt_table)
Problem is the evt_table part.

Suppose i have a function:

Code: Select all

function myfunc:changeX
self.x = mousex()
endfunction 
but now when i try to use it on evt_table:

Code: Select all

evt_table={OnMouseDown = myfunc:changeX}
it doesnt work.

Is there a way to access a self function in situation like this, or am i forced to not use self in situations like this?
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: Is it possible to use self in evt_table functions?

Post by airsoftsoftwair »

I'm afraid but that isn't supported at the moment. You can emulate it using the userdata parameter, though.
Bugala
Posts: 1178
Joined: Sun Feb 14, 2010 7:11 pm

Re: Is it possible to use self in evt_table functions?

Post by Bugala »

to wish list then.
Post Reply