[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Forwarding function calls from Lua->C->...
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Wed, 17 Jan 2001 22:24:29 -0200 (EDT)
>So far, so good. But what do I actually register when I call
>lua_register(state, ...)? I can't register an OPL function directly, so I
>have to give the address of some C(++) function in my interface DLL. But if
>I always give the same function, then how do I know which registered OPL
>function was supposed to be called when Lua makes the call to C?
>
>I suppose I want a way of fixing a parameter of the call that Lua makes to
>be the name of the OPL function, or the equivalent.
Push the name or a pointer to the actual OPL function as an upvalue to the
fixed C function and register this function in Lua as a C closure.
The emulation module lua3 does something similar because C functions in 3.x
have different signatures than in 4.x.
--lhf