[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: pushfunction
- From: Scott Parlane <scott@...>
- Date: Sun, 26 Apr 2009 05:39:24 +1200
Hi,
I was wondering what problems, if any I will have with using the
attached patch ?
I call lua_pushfunction() with a value I previously got from
lua_topointer() from the same lua_State (but not in the same call, so
the function is no longer on the stack)
Regards,
Scott
diff -rdu lua-5.1.4/src/lapi.c lua-mine/src/lapi.c
--- lua-5.1.4/src/lapi.c 2008-07-05 06:41:18.000000000 +1200
+++ lua-mine/src/lapi.c 2009-04-26 05:17:41.000000000 +1200
@@ -525,6 +525,13 @@
}
+LUA_API void lua_pushfunction (lua_State *L, const void *p) {
+ lua_lock(L);
+ setclvalue(L, L->top, p);
+ api_incr_top(L);
+ lua_unlock(L);
+}
+
/*
** get functions (Lua -> stack)
diff -rdu lua-5.1.4/src/lua.h lua-mine/src/lua.h
--- lua-5.1.4/src/lua.h 2008-08-07 01:30:12.000000000 +1200
+++ lua-mine/src/lua.h 2009-04-26 05:17:03.000000000 +1200
@@ -169,6 +169,7 @@
LUA_API void (lua_pushboolean) (lua_State *L, int b);
LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p);
LUA_API int (lua_pushthread) (lua_State *L);
+LUA_API void (lua_pushfunction) (lua_State *L, const void *p);
/*