lua-users home
lua-l archive

RE: How know what functions are defined in a lua script ?

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


Don't know but your first idea is good for me ...
Here is what I will do :
function on_XXX1
end
function on_XXX2
end
function on_XXX3
end
function testfunction(funcname)
	if strsub(funcname,0,3) == 'on_' then
		registerHandler(funcname)
	end
end
foreachvar(testfunction)
Then, for an incoming event I'll just have to see if a qualified handler exist for that object...
-----Message d'origine-----
De:	Vincent Penquerc'h [SMTP:vincent@calcaphon.com]
Date:	mercredi 29 mars 2000 11:38
A:	Multiple recipients of list
Objet:	RE: How know what functions are defined in a lua script ?
> It sounds like you'd be better off using a table to contain each 
> function and all the argument
> information you want.
I think the original poster did want to find out which functions
were added, without a registration system, and I think this table
would count as a registration system. But indeed, it would be
much simpler to do that...
To the original poster:
Or, without registration again, why not impose a naming convention,
a little like C++ name decoration, which adds characters to a
function name based on the parameters it expects...
Would this be too cumbersome ? And it looks like the beginnings
of registration too...
-- 
Lyrian 

AltStyle によって変換されたページ (->オリジナル) /