Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

[Rawset] [Edited] Block getfenv()??

Asked by 9 years ago

It shouldnt print Owner,PlaceId,etc... the rawset should block it.

I would like the function getfenv() to return "Blocked" as a string instead of getting the variables.

Owner = getfenv().owner -- not blocked yet(obv)
PlaceId = game.PlaceId
PlaceName = game.Name
PlaceJobId = game.JobId
PlaceDesc = game.MarketplaceService:GetProductInfo(PlaceId).Desc

rawset(getfenv(),'',{'[Rawset] Table does not exist'})  -- This should block getfenv() I think..
-- When I run this on a table it locks it,but then I cant get table main table back. 
table.foreach(getfenv(),print)

0
Can you explain precisely what it is that you want to happen, and what is happening instead? BlueTaslem 18071 — 9y
0
using getfenv() with table.foreach you can print ALL the variables in a script. And you can easily steal code like that. MessorAdmin 598 — 9y
0
I'm not sure how anyone with the power to append your script with code to read the function environment couldn't just read the script they're editing. Perhaps you're calling code created by players and sharing the function environment with them? Besides being dangerous, I don't think you could steal code if you just saw a list of variables (even if you had their values). chess123mate 5873 — 9y
0
^, Im trying to block code stealers. Im trying to protect my code. MessorAdmin 598 — 9y

1 answer

Log in to vote
2
Answered by 9 years ago

Would this do what you want?

function getfenv()
    return "Blocked"
end

It overwrites the definition of getfenv so that later on in the script, any attempt to use getfenv() will use your new function instead of the default one.

The rawset you're using just adds a new variable to the environment: a variable with no name with the value of a table with the "[Rawset] Table does not exist" string.

A consequence of the function I've proposed is that table.foreach(getfenv(),print) will error, since getfenv() no longer returns a table.

0
Omg.. why didnt I think of this.. XD Thanks! MessorAdmin 598 — 9y
Ad

Answer this question