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 6 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
6 years ago
Edited 6 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