Getgenv() Recreation

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!

To make a getgenv recreation in vLua Roblox

  1. What is the issue? Include screenshots / videos if possible!

getfenv()[index] = value doesnt work

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

Just getfenv()[index] = value and the same with _ENV

After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

i know it works in base Roblox LuaU but idk why it dont work in vLua

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

Additional info: ¿Why? I have this game called Kernel on Roblox to test out a loadstring with extra functions; A direct inspiration is GRH-Fake_Exploit

I found a solution: I basically just put every single global variable into env in vLua, and put getgenv to give out the env. Turns out it allows the env to be modified the same way as getfenv()[index] = value;

getfenv and setfenv were removed in Lua 5.2. Luau is based off of Lua 5.1. This was done for good reason; if you intend to use them in everyday production code, consider a redesign. The closest remaining functionality can be found in the debug library. You can do some awkward work with closures to emulate environment tables if you’re that adamant

Did you even read? I meant vLua; I’m doing it for a Loadstring which you can use extra functions, but i cannot set specific environment variables without overriding the entire environment.

I found a solution: I basically just put every single global variable into env in vLua, and put getgenv to give out the env. Turns out it allows the env to be modified the same way as getfenv()[index] = value;

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.