Page 1 of 1
[RESOLVED] getfenv and setfenv alternative?
Posted: Wed Apr 19, 2017 10:40 pm
by rater193
Hello, i was wondering if there was a workaround for using getfenv and setfenv, so i can add support for letting users adding basic lua code to their machines. If i cant use get/setfenv, then it will expose all game functions to the user, winch i was wanting to limit that with those functions.
Re: getfenv and setfenv alternative?
Posted: Thu Apr 20, 2017 1:31 am
by DaveMcW
Re: getfenv and setfenv alternative?
Posted: Thu Apr 20, 2017 5:29 am
by rater193
wow, that works

lol thx, i know that they removed a few features specific to lua in their api, unfortunately, one of the more usefull ones was getfenv and setfenv

Re: getfenv and setfenv alternative?
Posted: Thu Apr 20, 2017 5:32 am
by rater193
how would i write to a file?
Re: getfenv and setfenv alternative?
Posted: Thu Apr 20, 2017 5:45 am
by rater193
btw, i managed to get this to work
Code: Select all
/c local ret, err = load('local test = 1 print("load: "..tostring(load))', "", "bt", {["print"] = game.player.print, ["tostring"] = tostring})() game.player.print(tostring(ret)..", "..tostring(err))
im happy about that

thx again for the help, i didnt know that load was a part of ACTUAL lua lol