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

How to get all the variables of a function?

Asked by 5 years ago

I tried

function Load()
    CurrentBase = game.Workspace.Baseplate
    CurrentBase.BrickColor = BrickColor.Random()
end

for i, v in pairs(getfenv(Load)) do
    print(i,"=",v)
end

1 answer

Log in to vote
2
Answered by
metryy 306 Moderation Voter
5 years ago
Edited 5 years ago

You can just return the variables in the function

Example:

function Load()
    CurrentBase = workspace.Baseplate
    CurrentBase.BrickColor = Brickcolor.Random() 
    return CurrentBase, CurrentBase.BrickColor
end

print(Load())
Ad

Answer this question