lua-users home
lua-l archive

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


Hello all,

I'm just trying the depth of the ocean with my finger here...

Is it somehow possible to validate the number/types of parameters for lua functions from C/C++? More details ...


I already embedded lua as scripting engine in my project. What I do is to load the lua script, inspect the existence of certain lua functions in the script and if they exists I will call them when the time comes. Now, is it possible to also introspect/reflect on the number/types of parameters?

Some pseudo code:

if unable to load lua script
	return false

foreach functionName in functionsNamesList do
	if functionName doesn't exist //this works just fine
		continue

	if functionName parameters count different from expected //maybe possible
		continue

	if functionName parameters types different from expected //I bet that this is not possible....
		continue

	mark function as callable
done

Bottom line:
Is there any lua api for further describe a LUA_TFUNCTION in greater detail? (parameters count, types, return type, etc)? Even if I have only parameters count is still better than nothing.


Cheers,
Andrei

------
Eugen-Andrei Gavriloaie
Web: http://www.rtmpd.com