lua-users home
lua-l archive

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


On Sun, Jan 15, 2012 at 2:48 PM, Leo Razoumov <slonik.az@gmail.com> 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?

See the FFI Semantics section on callbacks:

http://luajit.org/ext_ffi_semantics.html#callback

(Ordinarily of course, you wouldn't call the created callback yourself
from Lua -- I just did that for minimal demonstration purposes. I can
confirm the same thing happens when it gets called from C.)

-Duncan