lua-users home
lua-l archive

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


> Your explanation makes more sense than the ref manual does. :)

The ref man is not about the innards of lua.c...
 
> Regarding to cpcall function, do I understand every host application should
> start with this function?

Yes, if the app wants to catch all errors. If you use lua_open, which is
as macro for luaL_newstate, then the auxlib catches errors and print error
messages to stderr in the form
	PANIC: unprotected error in call to Lua API (xxx)
Not pretty, but at least it alerts the host programmer.

> For instance, remove all options and interpretive mode and left only
> ones that require to load a script from command line in order to
> simplify the host application. Do I still need cpcall in it?

No, you could use the lua_open scheme as described above.
For a minimal interpreter, see etc/min.c.

> I don't quite follow the meaning of those options, "-" and "--". Could
> you give us an example?

"-" allows the Lua interpreter to be used in pipes.
"--" is a traditional POSIX option to signal end of options in case you
have a script whose name starts with '-'.

--lhf