lua

A copy of the Lua development repository
Log | Files | Refs | README

commit 4fe11ae232e37045feaaf08d72a5414fca463c1c
parent c549d4fe64c48ab645740e6d12c69c91250fad3d
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date:   Thu,  1 May 2014 15:21:07 -0300

'lua_getuservalue' returns type of user value

Diffstat:
Mlapi.c | 5+++--
Mlua.h | 4++--
2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lapi.c b/lapi.c @@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 2.207 2014/04/30 16:48:44 roberto Exp roberto $ +** $Id: lapi.c,v 2.208 2014/05/01 18:18:06 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -735,7 +735,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) { } -LUA_API void lua_getuservalue (lua_State *L, int idx) { +LUA_API int lua_getuservalue (lua_State *L, int idx) { StkId o; lua_lock(L); o = index2addr(L, idx); @@ -743,6 +743,7 @@ LUA_API void lua_getuservalue (lua_State *L, int idx) { getuservalue(L, rawuvalue(o), L->top); api_incr_top(L); lua_unlock(L); + return ttnov(L->top - 1); } diff --git a/lua.h b/lua.h @@ -1,5 +1,5 @@ /* -** $Id: lua.h,v 1.302 2014/03/20 19:42:35 roberto Exp roberto $ +** $Id: lua.h,v 1.303 2014/05/01 18:18:06 roberto Exp roberto $ ** Lua - A Scripting Language ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) ** See Copyright Notice at the end of this file @@ -238,7 +238,7 @@ LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p); LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); LUA_API int (lua_getmetatable) (lua_State *L, int objindex); -LUA_API void (lua_getuservalue) (lua_State *L, int idx); +LUA_API int (lua_getuservalue) (lua_State *L, int idx); /*