11/*
2- ** $Id: lapi.c,v 2.286 2018/02/23 13:13:31 roberto Exp roberto $
2+ ** $Id: lapi.c,v 2.287 2018/02/25 12:48:16 roberto Exp roberto $
33** Lua API
44** See Copyright Notice in lua.h
55*/
@@ -257,7 +257,7 @@ LUA_API void lua_pushvalue (lua_State *L, int idx) {
257257
258258LUA_API int lua_type (lua_State * L , int idx ) {
259259 const TValue * o = index2value (L , idx );
260- return (isvalid (o ) ? ttnov (o ) : LUA_TNONE );
260+ return (isvalid (o ) ? ttype (o ) : LUA_TNONE );
261261}
262262
263263
@@ -399,7 +399,7 @@ LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) {
399399
400400LUA_API lua_Unsigned lua_rawlen (lua_State * L , int idx ) {
401401 const TValue * o = index2value (L , idx );
402- switch (ttype (o )) {
402+ switch (ttypetag (o )) {
403403 case LUA_TSHRSTR : return tsvalue (o )-> shrlen ;
404404 case LUA_TLNGSTR : return tsvalue (o )-> u .lnglen ;
405405 case LUA_TUSERDATA : return uvalue (o )-> len ;
@@ -420,7 +420,7 @@ LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) {
420420
421421LUA_API void * lua_touserdata (lua_State * L , int idx ) {
422422 const TValue * o = index2value (L , idx );
423- switch (ttnov (o )) {
423+ switch (ttype (o )) {
424424 case LUA_TUSERDATA : return getudatamem (uvalue (o ));
425425 case LUA_TLIGHTUSERDATA : return pvalue (o );
426426 default : return NULL ;
@@ -436,7 +436,7 @@ LUA_API lua_State *lua_tothread (lua_State *L, int idx) {
436436
437437LUA_API const void * lua_topointer (lua_State * L , int idx ) {
438438 const TValue * o = index2value (L , idx );
439- switch (ttype (o )) {
439+ switch (ttypetag (o )) {
440440 case LUA_TTABLE : return hvalue (o );
441441 case LUA_TLCL : return clLvalue (o );
442442 case LUA_TCCL : return clCvalue (o );
@@ -606,7 +606,7 @@ static int auxgetstr (lua_State *L, const TValue *t, const char *k) {
606606 luaV_finishget (L , t , s2v (L -> top - 1 ), L -> top - 1 , slot );
607607 }
608608 lua_unlock (L );
609- return ttnov (s2v (L -> top - 1 ));
609+ return ttype (s2v (L -> top - 1 ));
610610}
611611
612612
@@ -628,7 +628,7 @@ LUA_API int lua_gettable (lua_State *L, int idx) {
628628 else
629629 luaV_finishget (L , t , s2v (L -> top - 1 ), L -> top - 1 , slot );
630630 lua_unlock (L );
631- return ttnov (s2v (L -> top - 1 ));
631+ return ttype (s2v (L -> top - 1 ));
632632}
633633
634634
@@ -653,7 +653,7 @@ LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) {
653653 }
654654 api_incr_top (L );
655655 lua_unlock (L );
656- return ttnov (s2v (L -> top - 1 ));
656+ return ttype (s2v (L -> top - 1 ));
657657}
658658
659659
@@ -664,7 +664,7 @@ static int finishrawget (lua_State *L, const TValue *val) {
664664 setobj2s (L , L -> top , val );
665665 api_incr_top (L );
666666 lua_unlock (L );
667- return ttnov (s2v (L -> top - 1 ));
667+ return ttype (s2v (L -> top - 1 ));
668668}
669669
670670
@@ -749,15 +749,15 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) {
749749 int res = 0 ;
750750 lua_lock (L );
751751 obj = index2value (L , objindex );
752- switch (ttnov (obj )) {
752+ switch (ttype (obj )) {
753753 case LUA_TTABLE :
754754 mt = hvalue (obj )-> metatable ;
755755 break ;
756756 case LUA_TUSERDATA :
757757 mt = uvalue (obj )-> metatable ;
758758 break ;
759759 default :
760- mt = G (L )-> mt [ttnov (obj )];
760+ mt = G (L )-> mt [ttype (obj )];
761761 break ;
762762 }
763763 if (mt != NULL ) {
@@ -782,7 +782,7 @@ LUA_API int lua_getiuservalue (lua_State *L, int idx, int n) {
782782 }
783783 else {
784784 setobj2s (L , L -> top , & uvalue (o )-> uv [n - 1 ].uv );
785- t = ttnov (s2v (L -> top ));
785+ t = ttype (s2v (L -> top ));
786786 }
787787 api_incr_top (L );
788788 lua_unlock (L );
@@ -917,7 +917,7 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) {
917917 api_check (L , ttistable (s2v (L -> top - 1 )), "table expected" );
918918 mt = hvalue (s2v (L -> top - 1 ));
919919 }
920- switch (ttnov (obj )) {
920+ switch (ttype (obj )) {
921921 case LUA_TTABLE : {
922922 hvalue (obj )-> metatable = mt ;
923923 if (mt ) {
@@ -935,7 +935,7 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) {
935935 break ;
936936 }
937937 default : {
938- G (L )-> mt [ttnov (obj )] = mt ;
938+ G (L )-> mt [ttype (obj )] = mt ;
939939 break ;
940940 }
941941 }
@@ -1295,7 +1295,7 @@ LUA_API void *lua_newuserdatauv (lua_State *L, size_t size, int nuvalue) {
12951295
12961296static const char * aux_upvalue (TValue * fi , int n , TValue * * val ,
12971297 GCObject * * owner ) {
1298- switch (ttype (fi )) {
1298+ switch (ttypetag (fi )) {
12991299 case LUA_TCCL : { /* C closure */
13001300 CClosure * f = clCvalue (fi );
13011301 if (!(1 <= n && n <= f -> nupvalues )) return NULL ;
@@ -1364,7 +1364,7 @@ static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) {
13641364
13651365LUA_API void * lua_upvalueid (lua_State * L , int fidx , int n ) {
13661366 TValue * fi = index2value (L , fidx );
1367- switch (ttype (fi )) {
1367+ switch (ttypetag (fi )) {
13681368 case LUA_TLCL : { /* lua closure */
13691369 return * getupvalref (L , fidx , n , NULL );
13701370 }
0 commit comments