From 150c92185ee209b193f9e61f6a72a73127b579ef Mon Sep 17 00:00:00 2001 From: LoganDark Date: Sun, 7 Nov 2021 13:44:41 -0800 Subject: [PATCH] move userdata to lua_Callbacks --- VM/include/lua.h | 2 ++ VM/src/lstate.cpp | 1 - VM/src/lstate.h | 2 -- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/VM/include/lua.h b/VM/include/lua.h index 2f93ad90..c8469b90 100644 --- a/VM/include/lua.h +++ b/VM/include/lua.h @@ -356,6 +356,8 @@ struct lua_Callbacks void (*debugstep)(lua_State* L, lua_Debug* ar); /* gets called after each instruction in single step mode */ void (*debuginterrupt)(lua_State* L, lua_Debug* ar); /* gets called when thread execution is interrupted by break in another thread */ void (*debugprotectederror)(lua_State* L); /* gets called when protected call results in an error */ + + void* userdata; /* arbitrary userdata pointer that is never overwritten by Luau */ }; LUA_API lua_Callbacks* lua_callbacks(lua_State* L); diff --git a/VM/src/lstate.cpp b/VM/src/lstate.cpp index 5b40f519..0b2dfb69 100644 --- a/VM/src/lstate.cpp +++ b/VM/src/lstate.cpp @@ -181,7 +181,6 @@ lua_State* lua_newstate(lua_Alloc f, void* ud) g->cb = lua_Callbacks(); g->gcstats = GCStats(); - g->userdata = NULL; if (luaD_rawrunprotected(L, f_luaopen, NULL) != 0) { diff --git a/VM/src/lstate.h b/VM/src/lstate.h index 90c1375d..56379883 100644 --- a/VM/src/lstate.h +++ b/VM/src/lstate.h @@ -189,8 +189,6 @@ typedef struct global_State GCStats gcstats; - void* userdata; - } global_State; // clang-format on