diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-05-31 11:34:02 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2005-05-31 11:34:02 -0300 |
commit | d628795940cb00420829077869c0efe5678b4e18 (patch) | |
tree | 882c6e993c7ffed27dcc142b2f15e88e95c5a073 | |
parent | 05348d834b48a4b0720d0576c797877b98642e63 (diff) | |
download | lua-d628795940cb00420829077869c0efe5678b4e18.tar.gz lua-d628795940cb00420829077869c0efe5678b4e18.tar.bz2 lua-d628795940cb00420829077869c0efe5678b4e18.zip |
lua_objsize -> lua_objlen (more compatible with use of `lenĀ“ in other
places [opcode name, metamethod index, etc.])
-rw-r--r-- | lapi.c | 4 | ||||
-rw-r--r-- | lauxlib.c | 6 | ||||
-rw-r--r-- | lauxlib.h | 4 | ||||
-rw-r--r-- | ltests.c | 4 | ||||
-rw-r--r-- | lua.h | 6 |
5 files changed, 12 insertions, 12 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.41 2005/05/17 19:49:15 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.42 2005/05/31 14:25:18 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 | */ |
@@ -351,7 +351,7 @@ LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { | |||
351 | } | 351 | } |
352 | 352 | ||
353 | 353 | ||
354 | LUA_API size_t lua_objsize (lua_State *L, int idx) { | 354 | LUA_API size_t lua_objlen (lua_State *L, int idx) { |
355 | StkId o = index2adr(L, idx); | 355 | StkId o = index2adr(L, idx); |
356 | switch (ttype(o)) { | 356 | switch (ttype(o)) { |
357 | case LUA_TSTRING: return tsvalue(o)->len; | 357 | case LUA_TSTRING: return tsvalue(o)->len; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.c,v 1.135 2005/05/31 14:25:18 roberto Exp roberto $ | 2 | ** $Id: lauxlib.c,v 1.136 2005/05/31 14:31:50 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 | */ |
@@ -317,7 +317,7 @@ LUALIB_API int luaL_getn (lua_State *L, int t) { | |||
317 | if ((n = checkint(L, 2)) >= 0) return n; | 317 | if ((n = checkint(L, 2)) >= 0) return n; |
318 | lua_getfield(L, t, "n"); /* else try t.n */ | 318 | lua_getfield(L, t, "n"); /* else try t.n */ |
319 | if ((n = checkint(L, 1)) >= 0) return n; | 319 | if ((n = checkint(L, 1)) >= 0) return n; |
320 | return lua_objsize(L, t); | 320 | return lua_objlen(L, t); |
321 | } | 321 | } |
322 | 322 | ||
323 | #endif | 323 | #endif |
@@ -542,7 +542,7 @@ LUALIB_API int luaL_ref (lua_State *L, int t) { | |||
542 | lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */ | 542 | lua_rawseti(L, t, FREELIST_REF); /* (t[FREELIST_REF] = t[ref]) */ |
543 | } | 543 | } |
544 | else { /* no free elements */ | 544 | else { /* no free elements */ |
545 | ref = lua_objsize(L, t); | 545 | ref = lua_objlen(L, t); |
546 | ref++; /* create new reference */ | 546 | ref++; /* create new reference */ |
547 | } | 547 | } |
548 | lua_rawseti(L, t, ref); | 548 | lua_rawseti(L, t, ref); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lauxlib.h,v 1.77 2005/05/25 13:21:26 roberto Exp roberto $ | 2 | ** $Id: lauxlib.h,v 1.78 2005/05/31 14:25:18 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 | */ |
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | 17 | ||
18 | #if !defined(LUA_COMPAT_GETN) | 18 | #if !defined(LUA_COMPAT_GETN) |
19 | #define luaL_getn(L,i) ((int)lua_objsize(L, i)) | 19 | #define luaL_getn(L,i) ((int)lua_objlen(L, i)) |
20 | #define luaL_setn(L,i,j) ((void)0) /* no op! */ | 20 | #define luaL_setn(L,i,j) ((void)0) /* no op! */ |
21 | #endif | 21 | #endif |
22 | 22 | ||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 2.23 2005/03/28 17:17:53 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 2.24 2005/05/03 19:01:17 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -882,7 +882,7 @@ static int testC (lua_State *L) { | |||
882 | lua_pushstring(L1, s); | 882 | lua_pushstring(L1, s); |
883 | } | 883 | } |
884 | else if EQ("objsize") { | 884 | else if EQ("objsize") { |
885 | lua_pushinteger(L1, lua_objsize(L1, getindex)); | 885 | lua_pushinteger(L1, lua_objlen(L1, getindex)); |
886 | } | 886 | } |
887 | else if EQ("tocfunction") { | 887 | else if EQ("tocfunction") { |
888 | lua_pushcfunction(L1, lua_tocfunction(L1, getindex)); | 888 | lua_pushcfunction(L1, lua_tocfunction(L1, getindex)); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lua.h,v 1.207 2005/05/16 19:21:11 roberto Exp roberto $ | 2 | ** $Id: lua.h,v 1.208 2005/05/17 19:49:15 roberto Exp roberto $ |
3 | ** Lua - An Extensible Extension Language | 3 | ** Lua - An Extensible Extension Language |
4 | ** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil | 4 | ** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil |
5 | ** http://www.lua.org | 5 | ** http://www.lua.org |
@@ -147,7 +147,7 @@ LUA_API lua_Number (lua_tonumber) (lua_State *L, int idx); | |||
147 | LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); | 147 | LUA_API lua_Integer (lua_tointeger) (lua_State *L, int idx); |
148 | LUA_API int (lua_toboolean) (lua_State *L, int idx); | 148 | LUA_API int (lua_toboolean) (lua_State *L, int idx); |
149 | LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); | 149 | LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); |
150 | LUA_API size_t (lua_objsize) (lua_State *L, int idx); | 150 | LUA_API size_t (lua_objlen) (lua_State *L, int idx); |
151 | LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); | 151 | LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); |
152 | LUA_API void *(lua_touserdata) (lua_State *L, int idx); | 152 | LUA_API void *(lua_touserdata) (lua_State *L, int idx); |
153 | LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); | 153 | LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); |
@@ -257,7 +257,7 @@ LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); | |||
257 | 257 | ||
258 | #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) | 258 | #define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) |
259 | 259 | ||
260 | #define lua_strlen(L,i) lua_objsize(L, (i)) | 260 | #define lua_strlen(L,i) lua_objlen(L, (i)) |
261 | 261 | ||
262 | #define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) | 262 | #define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) |
263 | #define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) | 263 | #define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) |