lua-users home
lua-l archive

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


I'm trying to load strict.lua (from the standard Lua distribution) via
luaL_dofile() in my C code just after creating the Lua state. In other
words, I do something like this:

lua_State* L = luaL_newstate();
if (luaL_dofile(L, "strict.lua")) {
  printf("failed to load strict.lua: %s\n", lua_tostring(L, -1));

However, this fails and the error is "C stack overflow" pointing to
line 18 in strict.lua:

local function what ()
  local d = debug.getinfo(3, "S")   --  this is line 18
  return d and d.what or "C"

Anybody an idea what is causing this and, more important, how to get it to work?