summaryrefslogtreecommitdiff
path: root/lapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'lapi.c')
-rw-r--r--lapi.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lapi.c b/lapi.c
index 7a1a72d3..ab0278b4 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 2.8 2004/05/11 16:52:08 roberto Exp roberto $ 2** $Id: lapi.c,v 2.9 2004/05/14 19:25:09 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*/
@@ -323,10 +323,12 @@ LUA_API const char *lua_tostring (lua_State *L, int idx) {
323} 323}
324 324
325 325
326LUA_API size_t lua_strlen (lua_State *L, int idx) { 326LUA_API size_t lua_objsize (lua_State *L, int idx) {
327 StkId o = luaA_index(L, idx); 327 StkId o = luaA_index(L, idx);
328 if (ttisstring(o)) 328 if (ttisstring(o))
329 return tsvalue(o)->len; 329 return tsvalue(o)->len;
330 else if (ttisuserdata(o))
331 return uvalue(o)->len;
330 else { 332 else {
331 size_t l; 333 size_t l;
332 lua_lock(L); /* `luaV_tostring' may create a new string */ 334 lua_lock(L); /* `luaV_tostring' may create a new string */