mirror of
https://github.com/lua/lua
synced 2026-09-26 16:17:11 +03:00
Function 'luaK_semerror' made vararg
All calls to 'luaK_semerror' were using 'luaO_pushfstring' to create the error messages.
This commit is contained in:
parent
3dbb1a4b89
commit
50fd8d03c3
3 changed files with 21 additions and 20 deletions
9
lcode.c
9
lcode.c
|
|
@ -40,7 +40,14 @@ static int codesJ (FuncState *fs, OpCode o, int sj, int k);
|
|||
|
||||
|
||||
/* semantic error */
|
||||
l_noret luaK_semerror (LexState *ls, const char *msg) {
|
||||
l_noret luaK_semerror (LexState *ls, const char *fmt, ...) {
|
||||
const char *msg;
|
||||
va_list argp;
|
||||
va_start(argp, fmt);
|
||||
msg = luaO_pushvfstring(ls->L, fmt, argp);
|
||||
va_end(argp);
|
||||
if (msg == NULL) /* error? */
|
||||
luaD_throw(ls->L, LUA_ERRMEM);
|
||||
ls->t.token = 0; /* remove "near <token>" from final message */
|
||||
luaX_syntaxerror(ls, msg);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue