diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-12-03 18:50:25 -0200 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-12-03 18:50:25 -0200 |
| commit | c78940f21a956064ac79f715af072e283538f35c (patch) | |
| tree | 5a879991ef8d68bbfd437f35ab1da8b761bf9f14 /lapi.c | |
| parent | 8b239eeba13877955b976ccd119ada038b67fa59 (diff) | |
| download | lua-c78940f21a956064ac79f715af072e283538f35c.tar.gz lua-c78940f21a956064ac79f715af072e283538f35c.tar.bz2 lua-c78940f21a956064ac79f715af072e283538f35c.zip | |
static names do not need `luaX_' prefix
Diffstat (limited to 'lapi.c')
| -rw-r--r-- | lapi.c | 82 |
1 files changed, 41 insertions, 41 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.19 2004/09/15 20:39:42 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.20 2004/11/24 18:55:56 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 | */ |
| @@ -45,7 +45,7 @@ const char lua_ident[] = | |||
| 45 | 45 | ||
| 46 | 46 | ||
| 47 | 47 | ||
| 48 | static TValue *luaA_index (lua_State *L, int idx) { | 48 | static TValue *index2adr (lua_State *L, int idx) { |
| 49 | if (idx > 0) { | 49 | if (idx > 0) { |
| 50 | TValue *o = L->base + (idx - 1); | 50 | TValue *o = L->base + (idx - 1); |
| 51 | api_check(L, idx <= L->ci->top - L->base); | 51 | api_check(L, idx <= L->ci->top - L->base); |
| @@ -160,7 +160,7 @@ LUA_API void lua_settop (lua_State *L, int idx) { | |||
| 160 | LUA_API void lua_remove (lua_State *L, int idx) { | 160 | LUA_API void lua_remove (lua_State *L, int idx) { |
| 161 | StkId p; | 161 | StkId p; |
| 162 | lua_lock(L); | 162 | lua_lock(L); |
| 163 | p = luaA_index(L, idx); | 163 | p = index2adr(L, idx); |
| 164 | api_checkvalidindex(L, p); | 164 | api_checkvalidindex(L, p); |
| 165 | while (++p < L->top) setobjs2s(L, p-1, p); | 165 | while (++p < L->top) setobjs2s(L, p-1, p); |
| 166 | L->top--; | 166 | L->top--; |
| @@ -172,7 +172,7 @@ LUA_API void lua_insert (lua_State *L, int idx) { | |||
| 172 | StkId p; | 172 | StkId p; |
| 173 | StkId q; | 173 | StkId q; |
| 174 | lua_lock(L); | 174 | lua_lock(L); |
| 175 | p = luaA_index(L, idx); | 175 | p = index2adr(L, idx); |
| 176 | api_checkvalidindex(L, p); | 176 | api_checkvalidindex(L, p); |
| 177 | for (q = L->top; q>p; q--) setobjs2s(L, q, q-1); | 177 | for (q = L->top; q>p; q--) setobjs2s(L, q, q-1); |
| 178 | setobjs2s(L, p, L->top); | 178 | setobjs2s(L, p, L->top); |
| @@ -184,7 +184,7 @@ LUA_API void lua_replace (lua_State *L, int idx) { | |||
| 184 | StkId o; | 184 | StkId o; |
| 185 | lua_lock(L); | 185 | lua_lock(L); |
| 186 | api_checknelems(L, 1); | 186 | api_checknelems(L, 1); |
| 187 | o = luaA_index(L, idx); | 187 | o = index2adr(L, idx); |
| 188 | api_checkvalidindex(L, o); | 188 | api_checkvalidindex(L, o); |
| 189 | setobj(L, o, L->top - 1); | 189 | setobj(L, o, L->top - 1); |
| 190 | if (idx < LUA_GLOBALSINDEX) /* function upvalue? */ | 190 | if (idx < LUA_GLOBALSINDEX) /* function upvalue? */ |
| @@ -196,7 +196,7 @@ LUA_API void lua_replace (lua_State *L, int idx) { | |||
| 196 | 196 | ||
| 197 | LUA_API void lua_pushvalue (lua_State *L, int idx) { | 197 | LUA_API void lua_pushvalue (lua_State *L, int idx) { |
| 198 | lua_lock(L); | 198 | lua_lock(L); |
| 199 | setobj2s(L, L->top, luaA_index(L, idx)); | 199 | setobj2s(L, L->top, index2adr(L, idx)); |
| 200 | api_incr_top(L); | 200 | api_incr_top(L); |
| 201 | lua_unlock(L); | 201 | lua_unlock(L); |
| 202 | } | 202 | } |
| @@ -209,7 +209,7 @@ LUA_API void lua_pushvalue (lua_State *L, int idx) { | |||
| 209 | 209 | ||
| 210 | 210 | ||
| 211 | LUA_API int lua_type (lua_State *L, int idx) { | 211 | LUA_API int lua_type (lua_State *L, int idx) { |
| 212 | StkId o = luaA_index(L, idx); | 212 | StkId o = index2adr(L, idx); |
| 213 | return (o == &luaO_nilobject) ? LUA_TNONE : ttype(o); | 213 | return (o == &luaO_nilobject) ? LUA_TNONE : ttype(o); |
| 214 | } | 214 | } |
| 215 | 215 | ||
| @@ -221,14 +221,14 @@ LUA_API const char *lua_typename (lua_State *L, int t) { | |||
| 221 | 221 | ||
| 222 | 222 | ||
| 223 | LUA_API int lua_iscfunction (lua_State *L, int idx) { | 223 | LUA_API int lua_iscfunction (lua_State *L, int idx) { |
| 224 | StkId o = luaA_index(L, idx); | 224 | StkId o = index2adr(L, idx); |
| 225 | return iscfunction(o); | 225 | return iscfunction(o); |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | 228 | ||
| 229 | LUA_API int lua_isnumber (lua_State *L, int idx) { | 229 | LUA_API int lua_isnumber (lua_State *L, int idx) { |
| 230 | TValue n; | 230 | TValue n; |
| 231 | const TValue *o = luaA_index(L, idx); | 231 | const TValue *o = index2adr(L, idx); |
| 232 | return tonumber(o, &n); | 232 | return tonumber(o, &n); |
| 233 | } | 233 | } |
| 234 | 234 | ||
| @@ -240,14 +240,14 @@ LUA_API int lua_isstring (lua_State *L, int idx) { | |||
| 240 | 240 | ||
| 241 | 241 | ||
| 242 | LUA_API int lua_isuserdata (lua_State *L, int idx) { | 242 | LUA_API int lua_isuserdata (lua_State *L, int idx) { |
| 243 | const TValue *o = luaA_index(L, idx); | 243 | const TValue *o = index2adr(L, idx); |
| 244 | return (ttisuserdata(o) || ttislightuserdata(o)); | 244 | return (ttisuserdata(o) || ttislightuserdata(o)); |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | 247 | ||
| 248 | LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { | 248 | LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { |
| 249 | StkId o1 = luaA_index(L, index1); | 249 | StkId o1 = index2adr(L, index1); |
| 250 | StkId o2 = luaA_index(L, index2); | 250 | StkId o2 = index2adr(L, index2); |
| 251 | return (o1 == &luaO_nilobject || o2 == &luaO_nilobject) ? 0 | 251 | return (o1 == &luaO_nilobject || o2 == &luaO_nilobject) ? 0 |
| 252 | : luaO_rawequalObj(o1, o2); | 252 | : luaO_rawequalObj(o1, o2); |
| 253 | } | 253 | } |
| @@ -257,8 +257,8 @@ LUA_API int lua_equal (lua_State *L, int index1, int index2) { | |||
| 257 | StkId o1, o2; | 257 | StkId o1, o2; |
| 258 | int i; | 258 | int i; |
| 259 | lua_lock(L); /* may call tag method */ | 259 | lua_lock(L); /* may call tag method */ |
| 260 | o1 = luaA_index(L, index1); | 260 | o1 = index2adr(L, index1); |
| 261 | o2 = luaA_index(L, index2); | 261 | o2 = index2adr(L, index2); |
| 262 | i = (o1 == &luaO_nilobject || o2 == &luaO_nilobject) ? 0 | 262 | i = (o1 == &luaO_nilobject || o2 == &luaO_nilobject) ? 0 |
| 263 | : equalobj(L, o1, o2); | 263 | : equalobj(L, o1, o2); |
| 264 | lua_unlock(L); | 264 | lua_unlock(L); |
| @@ -270,8 +270,8 @@ LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { | |||
| 270 | StkId o1, o2; | 270 | StkId o1, o2; |
| 271 | int i; | 271 | int i; |
| 272 | lua_lock(L); /* may call tag method */ | 272 | lua_lock(L); /* may call tag method */ |
| 273 | o1 = luaA_index(L, index1); | 273 | o1 = index2adr(L, index1); |
| 274 | o2 = luaA_index(L, index2); | 274 | o2 = index2adr(L, index2); |
| 275 | i = (o1 == &luaO_nilobject || o2 == &luaO_nilobject) ? 0 | 275 | i = (o1 == &luaO_nilobject || o2 == &luaO_nilobject) ? 0 |
| 276 | : luaV_lessthan(L, o1, o2); | 276 | : luaV_lessthan(L, o1, o2); |
| 277 | lua_unlock(L); | 277 | lua_unlock(L); |
| @@ -282,7 +282,7 @@ LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { | |||
| 282 | 282 | ||
| 283 | LUA_API lua_Number lua_tonumber (lua_State *L, int idx) { | 283 | LUA_API lua_Number lua_tonumber (lua_State *L, int idx) { |
| 284 | TValue n; | 284 | TValue n; |
| 285 | const TValue *o = luaA_index(L, idx); | 285 | const TValue *o = index2adr(L, idx); |
| 286 | if (tonumber(o, &n)) | 286 | if (tonumber(o, &n)) |
| 287 | return nvalue(o); | 287 | return nvalue(o); |
| 288 | else | 288 | else |
| @@ -292,7 +292,7 @@ LUA_API lua_Number lua_tonumber (lua_State *L, int idx) { | |||
| 292 | 292 | ||
| 293 | LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) { | 293 | LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) { |
| 294 | TValue n; | 294 | TValue n; |
| 295 | const TValue *o = luaA_index(L, idx); | 295 | const TValue *o = index2adr(L, idx); |
| 296 | if (tonumber(o, &n)) { | 296 | if (tonumber(o, &n)) { |
| 297 | lua_Integer res; | 297 | lua_Integer res; |
| 298 | lua_number2integer(res, nvalue(o)); | 298 | lua_number2integer(res, nvalue(o)); |
| @@ -304,13 +304,13 @@ LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) { | |||
| 304 | 304 | ||
| 305 | 305 | ||
| 306 | LUA_API int lua_toboolean (lua_State *L, int idx) { | 306 | LUA_API int lua_toboolean (lua_State *L, int idx) { |
| 307 | const TValue *o = luaA_index(L, idx); | 307 | const TValue *o = index2adr(L, idx); |
| 308 | return !l_isfalse(o); | 308 | return !l_isfalse(o); |
| 309 | } | 309 | } |
| 310 | 310 | ||
| 311 | 311 | ||
| 312 | LUA_API const char *lua_tostring (lua_State *L, int idx) { | 312 | LUA_API const char *lua_tostring (lua_State *L, int idx) { |
| 313 | StkId o = luaA_index(L, idx); | 313 | StkId o = index2adr(L, idx); |
| 314 | if (ttisstring(o)) | 314 | if (ttisstring(o)) |
| 315 | return svalue(o); | 315 | return svalue(o); |
| 316 | else { | 316 | else { |
| @@ -325,7 +325,7 @@ LUA_API const char *lua_tostring (lua_State *L, int idx) { | |||
| 325 | 325 | ||
| 326 | 326 | ||
| 327 | LUA_API size_t lua_objsize (lua_State *L, int idx) { | 327 | LUA_API size_t lua_objsize (lua_State *L, int idx) { |
| 328 | StkId o = luaA_index(L, idx); | 328 | StkId o = index2adr(L, idx); |
| 329 | if (ttisstring(o)) | 329 | if (ttisstring(o)) |
| 330 | return tsvalue(o)->len; | 330 | return tsvalue(o)->len; |
| 331 | else if (ttisuserdata(o)) | 331 | else if (ttisuserdata(o)) |
| @@ -341,13 +341,13 @@ LUA_API size_t lua_objsize (lua_State *L, int idx) { | |||
| 341 | 341 | ||
| 342 | 342 | ||
| 343 | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { | 343 | LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { |
| 344 | StkId o = luaA_index(L, idx); | 344 | StkId o = index2adr(L, idx); |
| 345 | return (!iscfunction(o)) ? NULL : clvalue(o)->c.f; | 345 | return (!iscfunction(o)) ? NULL : clvalue(o)->c.f; |
| 346 | } | 346 | } |
| 347 | 347 | ||
| 348 | 348 | ||
| 349 | LUA_API void *lua_touserdata (lua_State *L, int idx) { | 349 | LUA_API void *lua_touserdata (lua_State *L, int idx) { |
| 350 | StkId o = luaA_index(L, idx); | 350 | StkId o = index2adr(L, idx); |
| 351 | switch (ttype(o)) { | 351 | switch (ttype(o)) { |
| 352 | case LUA_TUSERDATA: return (rawuvalue(o) + 1); | 352 | case LUA_TUSERDATA: return (rawuvalue(o) + 1); |
| 353 | case LUA_TLIGHTUSERDATA: return pvalue(o); | 353 | case LUA_TLIGHTUSERDATA: return pvalue(o); |
| @@ -357,13 +357,13 @@ LUA_API void *lua_touserdata (lua_State *L, int idx) { | |||
| 357 | 357 | ||
| 358 | 358 | ||
| 359 | LUA_API lua_State *lua_tothread (lua_State *L, int idx) { | 359 | LUA_API lua_State *lua_tothread (lua_State *L, int idx) { |
| 360 | StkId o = luaA_index(L, idx); | 360 | StkId o = index2adr(L, idx); |
| 361 | return (!ttisthread(o)) ? NULL : thvalue(o); | 361 | return (!ttisthread(o)) ? NULL : thvalue(o); |
| 362 | } | 362 | } |
| 363 | 363 | ||
| 364 | 364 | ||
| 365 | LUA_API const void *lua_topointer (lua_State *L, int idx) { | 365 | LUA_API const void *lua_topointer (lua_State *L, int idx) { |
| 366 | StkId o = luaA_index(L, idx); | 366 | StkId o = index2adr(L, idx); |
| 367 | switch (ttype(o)) { | 367 | switch (ttype(o)) { |
| 368 | case LUA_TTABLE: return hvalue(o); | 368 | case LUA_TTABLE: return hvalue(o); |
| 369 | case LUA_TFUNCTION: return clvalue(o); | 369 | case LUA_TFUNCTION: return clvalue(o); |
| @@ -498,7 +498,7 @@ LUA_API int lua_pushthread (lua_State *L) { | |||
| 498 | LUA_API void lua_gettable (lua_State *L, int idx) { | 498 | LUA_API void lua_gettable (lua_State *L, int idx) { |
| 499 | StkId t; | 499 | StkId t; |
| 500 | lua_lock(L); | 500 | lua_lock(L); |
| 501 | t = luaA_index(L, idx); | 501 | t = index2adr(L, idx); |
| 502 | api_checkvalidindex(L, t); | 502 | api_checkvalidindex(L, t); |
| 503 | luaV_gettable(L, t, L->top - 1, L->top - 1, NULL); | 503 | luaV_gettable(L, t, L->top - 1, L->top - 1, NULL); |
| 504 | lua_unlock(L); | 504 | lua_unlock(L); |
| @@ -509,7 +509,7 @@ LUA_API void lua_getfield (lua_State *L, int idx, const char *k) { | |||
| 509 | StkId t; | 509 | StkId t; |
| 510 | TValue key; | 510 | TValue key; |
| 511 | lua_lock(L); | 511 | lua_lock(L); |
| 512 | t = luaA_index(L, idx); | 512 | t = index2adr(L, idx); |
| 513 | api_checkvalidindex(L, t); | 513 | api_checkvalidindex(L, t); |
| 514 | setsvalue(L, &key, luaS_new(L, k)); | 514 | setsvalue(L, &key, luaS_new(L, k)); |
| 515 | luaV_gettable(L, t, &key, L->top, NULL); | 515 | luaV_gettable(L, t, &key, L->top, NULL); |
| @@ -521,7 +521,7 @@ LUA_API void lua_getfield (lua_State *L, int idx, const char *k) { | |||
| 521 | LUA_API void lua_rawget (lua_State *L, int idx) { | 521 | LUA_API void lua_rawget (lua_State *L, int idx) { |
| 522 | StkId t; | 522 | StkId t; |
| 523 | lua_lock(L); | 523 | lua_lock(L); |
| 524 | t = luaA_index(L, idx); | 524 | t = index2adr(L, idx); |
| 525 | api_check(L, ttistable(t)); | 525 | api_check(L, ttistable(t)); |
| 526 | setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); | 526 | setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); |
| 527 | lua_unlock(L); | 527 | lua_unlock(L); |
| @@ -531,7 +531,7 @@ LUA_API void lua_rawget (lua_State *L, int idx) { | |||
| 531 | LUA_API void lua_rawgeti (lua_State *L, int idx, int n) { | 531 | LUA_API void lua_rawgeti (lua_State *L, int idx, int n) { |
| 532 | StkId o; | 532 | StkId o; |
| 533 | lua_lock(L); | 533 | lua_lock(L); |
| 534 | o = luaA_index(L, idx); | 534 | o = index2adr(L, idx); |
| 535 | api_check(L, ttistable(o)); | 535 | api_check(L, ttistable(o)); |
| 536 | setobj2s(L, L->top, luaH_getnum(hvalue(o), n)); | 536 | setobj2s(L, L->top, luaH_getnum(hvalue(o), n)); |
| 537 | api_incr_top(L); | 537 | api_incr_top(L); |
| @@ -553,7 +553,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) { | |||
| 553 | Table *mt = NULL; | 553 | Table *mt = NULL; |
| 554 | int res; | 554 | int res; |
| 555 | lua_lock(L); | 555 | lua_lock(L); |
| 556 | obj = luaA_index(L, objindex); | 556 | obj = index2adr(L, objindex); |
| 557 | switch (ttype(obj)) { | 557 | switch (ttype(obj)) { |
| 558 | case LUA_TTABLE: | 558 | case LUA_TTABLE: |
| 559 | mt = hvalue(obj)->metatable; | 559 | mt = hvalue(obj)->metatable; |
| @@ -577,7 +577,7 @@ LUA_API int lua_getmetatable (lua_State *L, int objindex) { | |||
| 577 | LUA_API void lua_getfenv (lua_State *L, int idx) { | 577 | LUA_API void lua_getfenv (lua_State *L, int idx) { |
| 578 | StkId o; | 578 | StkId o; |
| 579 | lua_lock(L); | 579 | lua_lock(L); |
| 580 | o = luaA_index(L, idx); | 580 | o = index2adr(L, idx); |
| 581 | api_checkvalidindex(L, o); | 581 | api_checkvalidindex(L, o); |
| 582 | setobj2s(L, L->top, isLfunction(o) ? &clvalue(o)->l.g : gt(L)); | 582 | setobj2s(L, L->top, isLfunction(o) ? &clvalue(o)->l.g : gt(L)); |
| 583 | api_incr_top(L); | 583 | api_incr_top(L); |
| @@ -594,7 +594,7 @@ LUA_API void lua_settable (lua_State *L, int idx) { | |||
| 594 | StkId t; | 594 | StkId t; |
| 595 | lua_lock(L); | 595 | lua_lock(L); |
| 596 | api_checknelems(L, 2); | 596 | api_checknelems(L, 2); |
| 597 | t = luaA_index(L, idx); | 597 | t = index2adr(L, idx); |
| 598 | api_checkvalidindex(L, t); | 598 | api_checkvalidindex(L, t); |
| 599 | luaV_settable(L, t, L->top - 2, L->top - 1, NULL); | 599 | luaV_settable(L, t, L->top - 2, L->top - 1, NULL); |
| 600 | L->top -= 2; /* pop index and value */ | 600 | L->top -= 2; /* pop index and value */ |
| @@ -607,7 +607,7 @@ LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { | |||
| 607 | TValue key; | 607 | TValue key; |
| 608 | lua_lock(L); | 608 | lua_lock(L); |
| 609 | api_checknelems(L, 1); | 609 | api_checknelems(L, 1); |
| 610 | t = luaA_index(L, idx); | 610 | t = index2adr(L, idx); |
| 611 | api_checkvalidindex(L, t); | 611 | api_checkvalidindex(L, t); |
| 612 | setsvalue(L, &key, luaS_new(L, k)); | 612 | setsvalue(L, &key, luaS_new(L, k)); |
| 613 | luaV_settable(L, t, &key, L->top - 1, NULL); | 613 | luaV_settable(L, t, &key, L->top - 1, NULL); |
| @@ -620,7 +620,7 @@ LUA_API void lua_rawset (lua_State *L, int idx) { | |||
| 620 | StkId t; | 620 | StkId t; |
| 621 | lua_lock(L); | 621 | lua_lock(L); |
| 622 | api_checknelems(L, 2); | 622 | api_checknelems(L, 2); |
| 623 | t = luaA_index(L, idx); | 623 | t = index2adr(L, idx); |
| 624 | api_check(L, ttistable(t)); | 624 | api_check(L, ttistable(t)); |
| 625 | setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1); | 625 | setobj2t(L, luaH_set(L, hvalue(t), L->top-2), L->top-1); |
| 626 | luaC_barriert(L, hvalue(t), L->top-1); | 626 | luaC_barriert(L, hvalue(t), L->top-1); |
| @@ -633,7 +633,7 @@ LUA_API void lua_rawseti (lua_State *L, int idx, int n) { | |||
| 633 | StkId o; | 633 | StkId o; |
| 634 | lua_lock(L); | 634 | lua_lock(L); |
| 635 | api_checknelems(L, 1); | 635 | api_checknelems(L, 1); |
| 636 | o = luaA_index(L, idx); | 636 | o = index2adr(L, idx); |
| 637 | api_check(L, ttistable(o)); | 637 | api_check(L, ttistable(o)); |
| 638 | setobj2t(L, luaH_setnum(L, hvalue(o), n), L->top-1); | 638 | setobj2t(L, luaH_setnum(L, hvalue(o), n), L->top-1); |
| 639 | luaC_barriert(L, hvalue(o), L->top-1); | 639 | luaC_barriert(L, hvalue(o), L->top-1); |
| @@ -648,7 +648,7 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) { | |||
| 648 | int res = 1; | 648 | int res = 1; |
| 649 | lua_lock(L); | 649 | lua_lock(L); |
| 650 | api_checknelems(L, 1); | 650 | api_checknelems(L, 1); |
| 651 | obj = luaA_index(L, objindex); | 651 | obj = index2adr(L, objindex); |
| 652 | api_checkvalidindex(L, obj); | 652 | api_checkvalidindex(L, obj); |
| 653 | if (ttisnil(L->top - 1)) | 653 | if (ttisnil(L->top - 1)) |
| 654 | mt = NULL; | 654 | mt = NULL; |
| @@ -685,7 +685,7 @@ LUA_API int lua_setfenv (lua_State *L, int idx) { | |||
| 685 | int res = 0; | 685 | int res = 0; |
| 686 | lua_lock(L); | 686 | lua_lock(L); |
| 687 | api_checknelems(L, 1); | 687 | api_checknelems(L, 1); |
| 688 | o = luaA_index(L, idx); | 688 | o = index2adr(L, idx); |
| 689 | api_checkvalidindex(L, o); | 689 | api_checkvalidindex(L, o); |
| 690 | api_check(L, ttistable(L->top - 1)); | 690 | api_check(L, ttistable(L->top - 1)); |
| 691 | if (isLfunction(o)) { | 691 | if (isLfunction(o)) { |
| @@ -751,7 +751,7 @@ LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { | |||
| 751 | if (errfunc == 0) | 751 | if (errfunc == 0) |
| 752 | func = 0; | 752 | func = 0; |
| 753 | else { | 753 | else { |
| 754 | StkId o = luaA_index(L, errfunc); | 754 | StkId o = index2adr(L, errfunc); |
| 755 | api_checkvalidindex(L, o); | 755 | api_checkvalidindex(L, o); |
| 756 | func = savestack(L, o); | 756 | func = savestack(L, o); |
| 757 | } | 757 | } |
| @@ -898,7 +898,7 @@ LUA_API int lua_next (lua_State *L, int idx) { | |||
| 898 | StkId t; | 898 | StkId t; |
| 899 | int more; | 899 | int more; |
| 900 | lua_lock(L); | 900 | lua_lock(L); |
| 901 | t = luaA_index(L, idx); | 901 | t = index2adr(L, idx); |
| 902 | api_check(L, ttistable(t)); | 902 | api_check(L, ttistable(t)); |
| 903 | more = luaH_next(L, hvalue(t), L->top - 1); | 903 | more = luaH_next(L, hvalue(t), L->top - 1); |
| 904 | if (more) { | 904 | if (more) { |
| @@ -970,7 +970,7 @@ LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { | |||
| 970 | const char *name; | 970 | const char *name; |
| 971 | TValue *val; | 971 | TValue *val; |
| 972 | lua_lock(L); | 972 | lua_lock(L); |
| 973 | name = aux_upvalue(L, luaA_index(L, funcindex), n, &val); | 973 | name = aux_upvalue(L, index2adr(L, funcindex), n, &val); |
| 974 | if (name) { | 974 | if (name) { |
| 975 | setobj2s(L, L->top, val); | 975 | setobj2s(L, L->top, val); |
| 976 | api_incr_top(L); | 976 | api_incr_top(L); |
| @@ -985,7 +985,7 @@ LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { | |||
| 985 | TValue *val; | 985 | TValue *val; |
| 986 | StkId fi; | 986 | StkId fi; |
| 987 | lua_lock(L); | 987 | lua_lock(L); |
| 988 | fi = luaA_index(L, funcindex); | 988 | fi = index2adr(L, funcindex); |
| 989 | api_checknelems(L, 1); | 989 | api_checknelems(L, 1); |
| 990 | name = aux_upvalue(L, fi, n, &val); | 990 | name = aux_upvalue(L, fi, n, &val); |
| 991 | if (name) { | 991 | if (name) { |
