lua-users home
lua-l archive

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


Leo Razoumov wrote:
> On the other hand, casting a Lua-function into a C-function does not
> seem to make much sense.  Can it lead to an undefined behavior?

It's quite useful for testing and well-defined. However you
shouldn't convert a Lua function to a C function pointer only to
call the C function from Lua. It calls out of the VM and then back
into the VM, with 2x argument/result conversions etc.

You can simply call any Lua function directly from Lua. :-)

--Mike