[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: callback implementation details..
- From: RLake@...
- Date: Fri, 17 Oct 2003 17:46:26 -0500
Hi, Virgil.
Did you try this code? I think it is what you might be looking for,
actually. Although you can do it with unpack() etc.
Or did I blow it somewhere?
static int l_docurry(lua_State *L) {
int n = lua_pushupvalues(L);
// lua_rotate would be useful here. Oh, well.
for (; n > 0; --n) lua_insert(L, 1);
lua_call(L, lua_gettop(L) - 1, LUA_MULTRET);
return lua_gettop(L);
}
// Register this one as curry
static int luaB_curry(lua_State *L) {
lua_pushcclosure(L, l_docurry, lua_gettop(L));
return 1;
}
Then you can just write:
curry(method, self)
or:
curry(method, self, 7)