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:
Roberto Ierusalimschy
2023-08-17 15:59:28 -03:00
parent f4211a5ea4
commit 9b4f39ab14
9 changed files with 37 additions and 33 deletions

View File

@@ -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);