More disciplined use of 'getstr' and 'tsslen'
We may want to add other string variants in the future; this change documents better where the code may need to handle those variants.
This commit is contained in:
2
lstate.c
2
lstate.c
@@ -433,7 +433,7 @@ void luaE_warning (lua_State *L, const char *msg, int tocont) {
|
||||
void luaE_warnerror (lua_State *L, const char *where) {
|
||||
TValue *errobj = s2v(L->top.p - 1); /* error object */
|
||||
const char *msg = (ttisstring(errobj))
|
||||
? svalue(errobj)
|
||||
? getstr(tsvalue(errobj))
|
||||
: "error object is not a string";
|
||||
/* produce warning "error in %s (%s)" (where, msg) */
|
||||
luaE_warning(L, "error in ", 1);
|
||||
|
||||
Reference in New Issue
Block a user