[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [LuaJIT FFI] Tailcalling string.byte() in a callback causes LuaJIT to crash
- From: Mike Pall <mikelu-1201@...>
- Date: Sun, 15 Jan 2012 17:18:59 +0100
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