lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


I have a table used as a class:

> table.foreach (GenericDesk,print);
sy 6
dir 0 
event_look    function: 0039e460
event_hit     function: 0039e580
......

then I do

>obj=GenericDesk:new();

where 

function GenericDesk:new (obj)
	obj=obj or {};
	setmetatable (obj,self);
	self.__index=self;
	return obj;
end

which I copied from the 'programming in lua' book,
16.1


then I do

>table.foreach (obj,print);

and I get a void list.


I was expecting the same result as the initial
table.foreach (GenericDesk,print) action. I think that
(remember, I'm a newbie ;) ) that the parameters are
there "by default", but they are not shown.

I'd like to know if there's any way to show them, as
I'm retreiving a list of functions which start with
"event_" to know which events are available for that
object.
I think I should search on obj.__index, but I'm not
sure if it's correct.

However, if I look at the object and the __index I can
get duplicate event functions, as objects can have
overloaded event functions.

Which should be the cleanest way to get a list of
"event_" starting functions of an object with a parent
class?

TIA
Kak.



	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com