diff options
Diffstat (limited to 'lauxlib.c')
| -rw-r--r-- | lauxlib.c | 8 |
1 files changed, 7 insertions, 1 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lauxlib.c,v 1.225 2010/11/09 11:04:15 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.226 2010/11/10 17:38:10 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 | */ |
| @@ -224,6 +224,12 @@ LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { | |||
| 224 | } | 224 | } |
| 225 | 225 | ||
| 226 | 226 | ||
| 227 | LUALIB_API void luaL_setmetatable (lua_State *L, const char *tname) { | ||
| 228 | luaL_getmetatable(L, tname); | ||
| 229 | lua_setmetatable(L, -2); | ||
| 230 | } | ||
| 231 | |||
| 232 | |||
| 227 | LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) { | 233 | LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) { |
| 228 | void *p = lua_touserdata(L, ud); | 234 | void *p = lua_touserdata(L, ud); |
| 229 | if (p != NULL) { /* value is a userdata? */ | 235 | if (p != NULL) { /* value is a userdata? */ |
