[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Binding To C Function
- From: "John Passaniti" <jmp@...>
- Date: Thu, 15 Jun 2000 11:30:35 -0400
Simple, possibly obvious question. The 3.2 Reference Manual-- which I
assume is the latest-- states the following in section 5.3:
"As a general rule, all API functions pop from the stack all elements they
use."
Yet, I don't see this in library functions. Take for example the C code
for strbyte:
static void str_byte (lua_State *L) {
long l;
const char *s = luaL_check_lstr(L, 1, &l);
long pos = posrelat(luaL_opt_long(L, 2, 1), l);
luaL_arg_check(L, 0<pos && pos<=l, 2, "out of range");
lua_pushnumber(L, (unsigned char)s[pos-1]);
}
Unless I'm missing something, stack elements are referenced, but they
aren't popped off.
I assume this is just a documentation issue; the code clearly works just
fine. Or am I missing something? I'm asking because I'm starting to
integrate Lua into my application, and I want to make sure I understand
what I'm doing.-- and doing it correctly.