[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Turning a C function into a Lua function
- From: Albert-Jan Brouwer <acj.brouwer@...>
- Date: Mon, 15 Sep 2003 19:14:44 +0200
Virgil Smith wrote:
> OK, you've confused me and I'm curious. What's wrong with lua_call or
> lua_pcall in this context. Scripts should not be able to distinguish Lua
> functions from C functions (and you can call either using
> lua_call/lua_pcall).
Calling the function via lua_resume instead of via lua_call/lua_pcall is
required since it must be possible to yield from inside these functions.
This is for two reasons: if the function does something protracted,
I have it yield every so many opcodes to allow for cooperative
scheduling (using the opcode counting hook). Also, there is a custom
calling mechanism that uses yield/resume.
---
Albert-Jan