lua-users home
lua-l archive

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


I see that there are many documentations about Lua but for my needs
there is no good reference. I use a mix between the:

- fantastic book from Roberto Ierusalimschy "Programming in Lua"
- wiki http://lua-users.org/wiki/LuaTutoria
- mailing list http://bazar2.conectiva.com.br/mailman/listinfo/lua
- the official manual http://www.lua.org/manual/5.0/manual.html

and sometimes other sources in the net. Each has positives and
negatives. So the official manual is >175kbyte long, the wiki groups the
statements/commands (you must decide a group, then load a long page and
then search after the statement)...

I prefer a reference where each statement is listet and linked to a page
that is particular the reference for this statement enriched with
examples and further hints & tipps. Yes! You are right: I can do this by
myself ;-) In the official http://lua-users.org/wiki/ ???

The point why I am writing this is the search after the difference
between pcall() and xpcall() and examples. I understand both from the
good explanation in Robertos book. But the book failed to give an
syntax example. So first I wrote an totally wrong code like this:

  Error,Message=xpcall(Function(arg1,arg2),
                       io.stderr:write(debug.traceback()))

The result was an half working system: if the code is ok then the
programm runs perfect but if the code is wrong then the complete
xpacll thing fails. So I fall back to use pcall and overlooked first the
syntax pcall(f,arg1,arg2,..) After loading and reading the wiki doc I
saw my mistake. So now it works:

  Error,Message=pcall(Function,arg1,arg2)

But then I missed the traceback feature. So again started a search...,
loaded huge docs, reading... and wondering about xpcall(f,err) Where is
the syntax to call f with arguments? Nowhere! No explanation, no
examples... nothing!


--
Markus