ok for that answer.
Why do you tell proxy ? I don’t understand.
Do you have the internal description code of the addEventListener function ?
Thanks
ok for that answer.
Why do you tell proxy ? I don’t understand.
Do you have the internal description code of the addEventListener function ?
Thanks
Why did you change original post to a new question?
Never never never … change your original post to ask a new question.
I simply won’t help you in the future if you do this again. The reasons for having a forum are:
Get help when you are stuck.
Keep a record of the conversation so others with similar questions can learn from the conversation in the future.
If you want to continue the discussion, add the new details at the end of the post, as long as it is closely related to the original question.
However, starting a whole new question at the end of a post bad practice. This is not an email thread.
Generally the best practice is ONE question per thread. i.e. Make new posts for new questions. This is most useful for future readers. If you’re extra awesome you can go back and link the threads to each other for future readers.
( Update: This may seem like a total freakout, but I put real effort into answering forums questions and It is a super-pet-peeve of mine to see that effort wasted. )
Your original text was:
Hello,
2 things :
First the “table listener” don’t work with a “tap” detection.
local t={}
t.tab=function() print(1) endlocal cercle=display.newCircle(0,0,30)
cercle:addEventListener(“tap”,t)
– Don’t work !Second, I so loved to have the inner code of the function “addEventListener”.
Is it possible to have an history link about this function ?
I think it’s firstly defined on stage.currentStage._class table and when we create a display object, an index table is automatically given to the metatable’s object with a key value look’s like "index.addEventListener=function(self,event)… "
Is it correct ? A clue pleased lol
Thanks.
Proxy
In your original question’s code snippet, you had this:
local t={} t.tab=function() print(1) end local cercle=display.newCircle(0,0,30) cercle:addEventListener("tap",t)
In this code, you are using the the table ‘t’ as a proxy to catch event. Or at least you were trying to. This is a valid practice, but is is advanced and most people do not need to do it in their apps or games.
Do you have the internal description code of the addEventListener function ?
No idea what this means. Please elaborate on ‘internal description’
lol sorry for the changes, i think it was good like that.
For the second question, I speak about the full code behind the addEventListener function, which means :
local function addEventListener(self,event) ... the code inside, i hope to have this ... end
Thanks 
I simple don’t understand what you mean.
Maybe you should explain this by giving me a concrete example of what you hope to achieve.
All I can say is. In the example I’ve given:
Edited and improved answer above.
My question is to know if it’s possible to have the code that create the addEventListener method.
For example,
local cercle=display.newCircle(0,0,30) cercle:addEventListener("touch",function(event) end)
In this example, the object “cercle” call the method “addEventListener” and then I write the event name “touch” and the listener function.
But what is the code executed inside that method ??
I imagine its begin like that :
local function addEventListener(self,eventName,listener) ... the code inside is what I want end
I think this gives me the answer.
So it’s impossible to have the original code build inside ?
Correct, It is not possible to access the plain text lua code.
You still haven’t said WHY you want to do this.
If you could elaborate on the why, I or others might have suggestions that help you achieve your true end goal.
Tip: Corona does (contrary to popular belief) support loadString, but you are NOT (according to the Apple guidelines) allowed to use it in iOS apps.
what a strange thread this is… I do not see the point in it at all! Very confusing…
Forum etiquette totally thrown out of the window, kicked down the road and booted into the river!
thread or threat?
thread… its late on Sunday
If all you’re interested in is how addEventListener works in general, here’s one implementation:
https://github.com/daveyang/EventDispatcher/blob/master/EventDispatcher.lua
Just to know how it work and how them made it.
ok thanks qwidave that’s what I wanted !