lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




On Wed, Dec 14, 2011 at 2:03 PM, Luiz Henrique de Figueiredo <lhf@tecgraf.puc-rio.br> wrote:
> If I don't do anything (don't pop values, don't use checkstack and don't
> use lua_settop(L, 0)) I run out of memory, no surprise there.

There is no need to lua_settop(L, 0) if you're in a C function called by Lua.
There is, however, a need to call lua_checkstack/luaL_checkstack if you
use more than 20 stack entries.

> How is proper stack handling supposed to be done?

Perhaps rebuilding Lua with LUA_USE_APICHECK on will help pinpoint the problem.

I rebuilt lua and got an assertion failure

Program: ...
File: lapi.c
Line:514

_expression_: L->top < L->ci->top

line 514 is within lua_pushlightuserdata

this doesn't really tell me much though...

I just #define LUA_USE_APICHECK in luaconf.h, am I supposed to write some sort of checking function as well or is this enough?