[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Error Propagation
- From: "Wesley Smith" <wesley.hoke@...>
- Date: Mon, 8 Jan 2007 09:43:03 -0800
FWIW, here's the macro I'm using instead of lua_error or luaL_Error to
trackback to the proper level for reporting errors to users:
#define SCRIPT_ERROR(L, level, string, ...)
lua_getglobal(L, "error"); \
lua_pushfstring(L, string, __VA_ARGS__); \
lua_pushinteger(L, level); \
lua_call(L, 2, 0);
test examples:
SCRIPT_ERROR(L, 4, "invalid argument 2 for jit.attribute, must be
string %d", 999);
SCRIPT_ERROR(L, 4, "invalid argument 2 for jit.attribute, must be
string", NULL);
You still have to provide a 4th argument to the macro, but it can be NULL.
wes