diff options
Diffstat (limited to 'apps/plugins/lua/lparser.c')
-rw-r--r-- | apps/plugins/lua/lparser.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/plugins/lua/lparser.c b/apps/plugins/lua/lparser.c index dda7488dca..d002e96b86 100644 --- a/apps/plugins/lua/lparser.c +++ b/apps/plugins/lua/lparser.c | |||
@@ -383,14 +383,18 @@ static void close_func (LexState *ls) { | |||
383 | Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) { | 383 | Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) { |
384 | struct LexState lexstate; | 384 | struct LexState lexstate; |
385 | struct FuncState funcstate; | 385 | struct FuncState funcstate; |
386 | TString *tname = luaS_new(L, name); | ||
387 | setsvalue2s(L, L->top, tname); /* protect name */ | ||
388 | incr_top(L); | ||
386 | lexstate.buff = buff; | 389 | lexstate.buff = buff; |
387 | luaX_setinput(L, &lexstate, z, luaS_new(L, name)); | 390 | luaX_setinput(L, &lexstate, z, tname); |
388 | open_func(&lexstate, &funcstate); | 391 | open_func(&lexstate, &funcstate); |
389 | funcstate.f->is_vararg = VARARG_ISVARARG; /* main func. is always vararg */ | 392 | funcstate.f->is_vararg = VARARG_ISVARARG; /* main func. is always vararg */ |
390 | luaX_next(&lexstate); /* read first token */ | 393 | luaX_next(&lexstate); /* read first token */ |
391 | chunk(&lexstate); | 394 | chunk(&lexstate); |
392 | check(&lexstate, TK_EOS); | 395 | check(&lexstate, TK_EOS); |
393 | close_func(&lexstate); | 396 | close_func(&lexstate); |
397 | L->top--; /* remove 'name' from stack */ | ||
394 | lua_assert(funcstate.prev == NULL); | 398 | lua_assert(funcstate.prev == NULL); |
395 | lua_assert(funcstate.f->nups == 0); | 399 | lua_assert(funcstate.f->nups == 0); |
396 | lua_assert(lexstate.fs == NULL); | 400 | lua_assert(lexstate.fs == NULL); |