lua-users home
lua-l archive

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


> Is there any way to determine that a function is suitable for 
> seriali[sz]ation with string.dump() other than by using debug.getupvalue()  
> to check if it has upvalues?

You can use debug.getinfo(f,"u").nups.

Or you can string.dump it and read that value from there:

 s=string.dump(f)
 ni=string.byte(s,9)
 n=string.byte(s,13)
 n=string.byte(s,16+n+2*ni+1)
 print(n)

--lhf