mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Fix luau_load 'env' argument to work with absolute stack index
This commit is contained in:
parent
35e497b533
commit
07a0e0e111
1 changed files with 3 additions and 3 deletions
|
@ -9,6 +9,7 @@
|
|||
#include "lgc.h"
|
||||
#include "lmem.h"
|
||||
#include "lbytecode.h"
|
||||
#include "lapi.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
@ -162,9 +163,8 @@ int luau_load(lua_State* L, const char* chunkname, const char* data, size_t size
|
|||
size_t GCthreshold = L->global->GCthreshold;
|
||||
L->global->GCthreshold = SIZE_MAX;
|
||||
|
||||
// env is 0 for current environment and a stack relative index otherwise
|
||||
LUAU_ASSERT(env <= 0 && L->top - L->base >= -env);
|
||||
Table* envt = (env == 0) ? hvalue(gt(L)) : hvalue(L->top + env);
|
||||
// env is 0 for current environment and a stack index otherwise
|
||||
Table* envt = (env == 0) ? hvalue(gt(L)) : hvalue(luaA_toobject(L, env));
|
||||
|
||||
TString* source = luaS_new(L, chunkname);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue