diff options
Diffstat (limited to 'lauxlib.c')
-rw-r--r-- | lauxlib.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.195 2009/12/17 16:20:01 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.196 2009/12/22 15:32:50 roberto Exp roberto $ |
3 | ** Auxiliary functions for building Lua libraries | 3 | ** Auxiliary functions for building Lua libraries |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -773,3 +773,14 @@ LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver) { | |||
773 | ver, *v); | 773 | ver, *v); |
774 | } | 774 | } |
775 | 775 | ||
776 | |||
777 | LUALIB_API int luaL_cpcall (lua_State *L, lua_CFunction f, int nargs, | ||
778 | int nresults) { | ||
779 | nargs++; /* to include function itself */ | ||
780 | lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_CPCALL); | ||
781 | lua_insert(L, -nargs); | ||
782 | lua_pushlightuserdata(L, &f); | ||
783 | lua_insert(L, -nargs); | ||
784 | return lua_pcall(L, nargs, nresults, 0); | ||
785 | } | ||
786 | |||