diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-07-18 11:46:47 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-07-18 11:46:47 -0300 |
commit | bb129031205acc64eb6b41c98d8a08c1fccce308 (patch) | |
tree | 65e01a5af21d2867c3108507ed0afbb8d32201bd /lapi.c | |
parent | ca41b43f53562e64abe433d6346d174c92548603 (diff) | |
download | lua-bb129031205acc64eb6b41c98d8a08c1fccce308.tar.gz lua-bb129031205acc64eb6b41c98d8a08c1fccce308.tar.bz2 lua-bb129031205acc64eb6b41c98d8a08c1fccce308.zip |
type 'Udata' refers directly to structure inside the union (union
used only for aligning purposes now)
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.226 2014/07/17 13:53:37 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.227 2014/07/18 12:17:54 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -420,7 +420,7 @@ LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { | |||
420 | LUA_API void *lua_touserdata (lua_State *L, int idx) { | 420 | LUA_API void *lua_touserdata (lua_State *L, int idx) { |
421 | StkId o = index2addr(L, idx); | 421 | StkId o = index2addr(L, idx); |
422 | switch (ttnov(o)) { | 422 | switch (ttnov(o)) { |
423 | case LUA_TUSERDATA: return (rawuvalue(o) + 1); | 423 | case LUA_TUSERDATA: return getudatamem(uvalue(o)); |
424 | case LUA_TLIGHTUSERDATA: return pvalue(o); | 424 | case LUA_TLIGHTUSERDATA: return pvalue(o); |
425 | default: return NULL; | 425 | default: return NULL; |
426 | } | 426 | } |
@@ -706,7 +706,7 @@ LUA_API int lua_getuservalue (lua_State *L, int idx) { | |||
706 | lua_lock(L); | 706 | lua_lock(L); |
707 | o = index2addr(L, idx); | 707 | o = index2addr(L, idx); |
708 | api_check(ttisfulluserdata(o), "full userdata expected"); | 708 | api_check(ttisfulluserdata(o), "full userdata expected"); |
709 | getuservalue(L, rawuvalue(o), L->top); | 709 | getuservalue(L, uvalue(o), L->top); |
710 | api_incr_top(L); | 710 | api_incr_top(L); |
711 | lua_unlock(L); | 711 | lua_unlock(L); |
712 | return ttnov(L->top - 1); | 712 | return ttnov(L->top - 1); |
@@ -842,7 +842,7 @@ LUA_API void lua_setuservalue (lua_State *L, int idx) { | |||
842 | api_checknelems(L, 1); | 842 | api_checknelems(L, 1); |
843 | o = index2addr(L, idx); | 843 | o = index2addr(L, idx); |
844 | api_check(ttisfulluserdata(o), "full userdata expected"); | 844 | api_check(ttisfulluserdata(o), "full userdata expected"); |
845 | setuservalue(L, rawuvalue(o), L->top - 1); | 845 | setuservalue(L, uvalue(o), L->top - 1); |
846 | luaC_barrier(L, gcvalue(o), L->top - 1); | 846 | luaC_barrier(L, gcvalue(o), L->top - 1); |
847 | L->top--; | 847 | L->top--; |
848 | lua_unlock(L); | 848 | lua_unlock(L); |
@@ -1142,7 +1142,7 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size) { | |||
1142 | setuvalue(L, L->top, u); | 1142 | setuvalue(L, L->top, u); |
1143 | api_incr_top(L); | 1143 | api_incr_top(L); |
1144 | lua_unlock(L); | 1144 | lua_unlock(L); |
1145 | return u + 1; | 1145 | return getudatamem(u); |
1146 | } | 1146 | } |
1147 | 1147 | ||
1148 | 1148 | ||