[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: 5.2 refman misstates stack signature of luaL_len?
- From: Dubiousjim <lists+lua@...>
- Date: Fri, 18 May 2012 15:07:58 -0400
The 5.2 reference manual states the stack behavior of luaL_len as [-0, +1, e].
But judging by lauxlib.c, it looks like it's instead [-0, +0, e].
LUALIB_API int luaL_len (lua_State *L, int idx) {
int l;
int isnum;
lua_len(L, idx); /* <---- this pushes an object to stack */
l = (int)lua_tointegerx(L, -1, &isnum);
if (!isnum)
luaL_error(L, "object length is not a number");
lua_pop(L, 1); /* remove object <----- but notice */
return l;
}
--
Jim Pryor
dubiousjim@gmail.com