[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: collected c calls faster?
- From: Jerome Vuarand <jerome.vuarand@...>
- Date: Tue, 18 Oct 2011 17:24:51 +0200
2011/10/18 Oskar Forsslund <firstname.lastname@example.org>:
> let me clarify. I do it like this:
> lua_cfunction func = lua_tocfunction(L, -1);
IMHO that's an abuse of lua_CFunction. Calling them that way you're
losing upvalues, the called function doesn't get a clean input stack,
and its output stack won't be trimmed like it would if it went through
a lua_call. To store function pointers used like that you should use
light userdata. But that's not the issue.
> that shouldn't need any lua involvement right?
No, Lua shouldn't be involved, and provided you don't use upvalues
from C and you keep the stack balanced, there shouldn't be any speed
Can you provide a full but minimal working example? I would bet that
in creating one you will find the root cause of your problem, but even
if you don't we will for sure.