lua-users home
lua-l archive

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


I have a function that calls luaL_argcheck(), but when I call it with pcall:

  print(pcall(mylib.read, 2))

I get:

.... bad argument #2 to '?' (attempt to read past end of ready data)

However, my top level call into lua (which uses the lua_pcall api and
provides debug.traceback as its err handler), as well as local calls
to xpcall:

 print(xpcall(function () mylib.read(2) end, debug.traceback))

prints error msg strings with the function name:

... bad argument #2 to 'read'

Is that just the nature of things, that if debug.traceback isn't
called, information about function names on the stack aren't filled
in, and argcheck can't know the calling function's name?

Thanks,
Sam