Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local myfunc = Value
- local myfuncnumber = Value2
- local locate = function(name)
- local t = {}
- for _, v in pairs(getgc()) do
- if type(v) == "function" and not is_synapse_function(v) then
- if getinfo(v).name == name then
- t[#t+1]=v
- end
- end
- end
- return t;
- end
- -- this is a modified function I'm working on.
- local defaultSettings = {
- pretty = true;
- robloxFullName = true;
- robloxProperFullName = true;
- robloxClassName = true;
- sortKeys = true;
- }
- local function isLuaIdentifier(str)
- if type(str) ~= "string" then return false end
- -- must be nonempty
- if str:len() == 0 then return false end
- -- can only contain a-z, A-Z, 0-9 and underscore
- if str:find("[^%d%a_]") then return false end
- -- cannot begin with digit
- if tonumber(str:sub(1, 1)) then return false end
- return true
- end
- -- works like Instance:GetFullName(), but invalid Lua identifiers are fixed (e.g. workspace["The Dude"].Humanoid)
- local function properFullName(object, usePeriod)
- if object == nil or object == game then return "" end
- local s = object.Name
- local usePeriod = true
- if not isLuaIdentifier(s) then
- s = ("[%q]"):format(s)
- usePeriod = false
- end
- if not object.Parent or object.Parent == game then
- return s
- else
- return properFullName(object.Parent) .. (usePeriod and "." or "") .. s
- end
- end
- local depth = 0
- local shown
- local INDENT
- local jsonSettings
- local typeof = typeof;
- local function json(value, jsonSettings)
- jsonSettings = jsonSettings or defaultSettings
- INDENT = "\t"
- local v = value --args[1]
- local tabs = INDENT:rep(depth)
- if depth == 0 then
- shown = {}
- end
- if type(v) == "string" then
- return ("%q"):format(v)
- elseif type(v) == "number" then
- if v == math.huge then return "Math.huge" end
- if v == -math.huge then return "-Math.huge" end
- return tonumber(v)
- elseif type(v) == "boolean" then
- return tostring(v)
- elseif type(v) == "nil" then
- return nil
- elseif type(v) == "table" and type(v.__tostring) == "function" then
- return tostring(v.__tostring(v))
- elseif type(v) == "table" and getmetatable(v) and type(getmetatable(v).__tostring) == "function" then
- return tostring(getmetatable(v).__tostring(v))
- elseif type(v) == "table" then
- if shown[v] then return "CYCLIC" end
- shown[v] = true
- local str = "Table({" .. (jsonSettings.pretty and ("\n" .. INDENT .. tabs) or "")
- local isArray = true
- for k, v in pairs(v) do
- if type(k) ~= "number" then
- isArray = false
- break
- end
- end
- if isArray then
- for i = 1, #v do
- if i ~= 1 then
- str = str .. "," .. (jsonSettings.pretty and ("\n" .. INDENT .. tabs) or " ")
- end
- depth = depth + 1
- str = str .. i .. ":" .. json(v[i], jsonSettings)
- depth = depth - 1
- end
- else
- local keyOrder = {}
- local keyValueStrings = {}
- for k, v in pairs(v) do
- depth = depth + 1
- local kStr = isLuaIdentifier(k) and k or ("" .. json(k, jsonSettings) .. "")
- local vStr = json(v, jsonSettings)
- --[[str = str .. ("%s = %s"):format(
- isLuaIdentifier(k) and k or ("[" .. json(k, jsonSettings) .. "]"),
- json(v, jsonSettings)
- )]]
- table.insert(keyOrder, kStr)
- keyValueStrings[kStr] = vStr
- depth = depth - 1
- end
- if jsonSettings.sortKeys then table.sort(keyOrder) end
- local first = true
- for _, kStr in pairs(keyOrder) do
- if not first then
- str = str .. "," .. (jsonSettings.pretty and ("\n" .. INDENT .. tabs) or " ")
- end
- str = str .. ("%s : %s"):format(kStr, keyValueStrings[kStr])
- first = false
- end
- end
- shown[v] = false
- if jsonSettings.pretty then
- str = str .. "\n" .. tabs
- end
- str = str .. "}, " .. ({ tostring(v):gsub("table: ", "") })[1] .. ")"
- return str
- elseif typeof then
- -- Check Roblox types
- if typeof(v) == "Instance" then
- return "Instance(\"" .. (jsonSettings.robloxFullName
- and (jsonSettings.robloxProperFullName and properFullName(v) or v:GetFullName())
- or v.Name) .. (jsonSettings.robloxClassName and (("\", %s"):format(v.ClassName)) or "") .. ")"
- elseif typeof(v) == "Axes" then
- local s = {}
- if v.X then table.insert(s, json(Enum.Axis.X, jsonSettings)) end
- if v.Y then table.insert(s, json(Enum.Axis.Y, jsonSettings)) end
- if v.Z then table.insert(s, json(Enum.Axis.Z, jsonSettings)) end
- return ("Axes(%s)"):format(table.concat(s, ", "))
- elseif typeof(v) == "BrickColor" then
- return ("BrickColor(%q)"):format(v.Name)
- elseif typeof(v) == "CFrame" then
- return ("CFrame(%s)"):format(table.concat({v:GetComponents()}, ", "))
- elseif typeof(v) == "Color3" then
- return ("Color3(%d, %d, %d)"):format(v.r, v.g, v.b)
- elseif typeof(v) == "ColorSequence" then
- if #v.Keypoints > 2 then
- return ("ColorSequence(%s)"):format(json(v.Keypoints, jsonSettings))
- else
- if v.Keypoints[1].Value == v.Keypoints[2].Value then
- return ("ColorSequence(%s)"):format(json(v.Keypoints[1].Value, jsonSettings))
- else
- return ("ColorSequence(%s, %s)"):format(
- json(v.Keypoints[1].Value, jsonSettings),
- json(v.Keypoints[2].Value, jsonSettings)
- )
- end
- end
- elseif typeof(v) == "ColorSequenceKeypoint" then
- return ("ColorSequenceKeypoint(%d, %s)"):format(v.Time, json(v.Value, jsonSettings))
- elseif typeof(v) == "DockWidgetPluginGuiInfo" then
- return ("DockWidgetPluginGuiInfo(%s, %s, %s, %s, %s, %s, %s)"):format(
- json(v.InitialDockState, jsonSettings),
- json(v.InitialEnabled, jsonSettings),
- json(v.InitialEnabledShouldOverrideRestore, jsonSettings),
- json(v.FloatingXSize, jsonSettings),
- json(v.FloatingYSize, jsonSettings),
- json(v.MinWidth, jsonSettings),
- json(v.MinHeight, jsonSettings)
- )
- elseif typeof(v) == "Enums" then
- return "Enums"
- elseif typeof(v) == "Enum" then
- return ("Enum.%s"):format(tostring(v))
- elseif typeof(v) == "EnumItem" then
- return ("Enum.%s.%s"):format(tostring(v.EnumType), v.Name)
- elseif typeof(v) == "Faces" then
- local s = {}
- for _, enumItem in pairs(Enum.NormalId:GetEnumItems()) do
- if v[enumItem.Name] then
- table.insert(s, json(enumItem, jsonSettings))
- end
- end
- return ("Faces(%s)"):format(table.concat(s, ", "))
- elseif typeof(v) == "NumberRange" then
- if v.Min == v.Max then
- return ("NumberRange(%d)"):format(v.Min)
- else
- return ("NumberRange(%d, %d)"):format(v.Min, v.Max)
- end
- elseif typeof(v) == "NumberSequence" then
- if #v.Keypoints > 2 then
- return ("NumberSequence(%s)"):format(json(v.Keypoints, jsonSettings))
- else
- if v.Keypoints[1].Value == v.Keypoints[2].Value then
- return ("NumberSequence(%d)"):format(v.Keypoints[1].Value)
- else
- return ("NumberSequence(%d, %d)"):format(v.Keypoints[1].Value, v.Keypoints[2].Value)
- end
- end
- elseif typeof(v) == "NumberSequenceKeypoint" then
- if v.Envelope ~= 0 then
- return ("NumberSequenceKeypoint(%d, %d, %d)"):format(v.Time, v.Value, v.Envelope)
- else
- return ("NumberSequenceKeypoint(%d, %d)"):format(v.Time, v.Value)
- end
- elseif typeof(v) == "PathWaypoint" then
- return ("PathWaypoint(%s, %s)"):format(
- json(v.Position, jsonSettings),
- json(v.Action, jsonSettings)
- )
- elseif typeof(v) == "PhysicalProperties" then
- return ("PhysicalProperties(%d, %d, %d, %d, %d)"):format(
- v.Density, v.Friction, v.Elasticity, v.FrictionWeight, v.ElasticityWeight
- )
- elseif typeof(v) == "Random" then
- return "random()"
- elseif typeof(v) == "Ray" then
- return ("Ray(%s, %s)"):format(
- json(v.Origin, jsonSettings),
- json(v.Direction, jsonSettings)
- )
- elseif typeof(v) == "RBXScriptConnection" then
- return "ScriptConnection()"
- elseif typeof(v) == "RBXScriptSignal" then
- return "ScriptSignal()"
- elseif typeof(v) == "Rect" then
- return ("Rect(%d, %d, %d, %d)"):format(
- v.Min.X, v.Min.Y, v.Max.X, v.Max.Y
- )
- elseif typeof(v) == "Region3" then
- local min = v.CFrame.p + v.Size * -.5
- local max = v.CFrame.p + v.Size * .5
- return ("Region3(%s, %s)"):format(
- json(min, jsonSettings),
- json(max, jsonSettings)
- )
- elseif typeof(v) == "Region3int16" then
- return ("Region3int16(%s, %s)"):format(
- json(v.Min, jsonSettings),
- json(v.Max, jsonSettings)
- )
- elseif typeof(v) == "TweenInfo" then
- return ("TweenInfo(%d, %s, %s, %d, %s, %d)"):format(
- v.Time, json(v.EasingStyle, jsonSettings), json(v.EasingDirection, jsonSettings),
- v.RepeatCount, json(v.Reverses, jsonSettings), v.DelayTime
- )
- elseif typeof(v) == "UDim" then
- return ("UDim(%d, %d)"):format(
- v.Scale, v.Offset
- )
- elseif typeof(v) == "UDim2" then
- return ("UDim2(%d, %d, %d, %d)"):format(
- v.X.Scale, v.X.Offset, v.Y.Scale, v.Y.Offset
- )
- elseif typeof(v) == "Vector2" then
- return ("Vector2(%d, %d"):format(v.X, v.Y)
- elseif typeof(v) == "Vector2int16" then
- return ("Vector2int16(%d, %d)"):format(v.X, v.Y)
- elseif typeof(v) == "Vector3" then
- return ("Vector3(%d, %d, %d)"):format(v.X, v.Y, v.Z)
- elseif typeof(v) == "Vector3int16" then
- return ("Vector3int16(%d, %d, %d)"):format(v.X, v.Y, v.Z)
- else
- if type(v) == "function" then
- return "funct(\"" .. getinfo(v).name .."\"," .. ({ tostring(v):gsub("function: ", "") })[1] .. ")"
- end
- return typeof(v)
- end
- else
- return type(v)
- end
- end
- local function Env_Dump(func)
- local tab = {
- upvalues=getupvalues(func),
- constants=getconstants(func),
- protos=getprotos(func),
- fenv = getfenv(func)
- }
- rconsoleprint("DUMP\n")
- rconsoleprint(json(getinfo(func)) .. "\n\n")
- rconsoleprint(json(tab) .. "\n")
- rconsoleprint("END\n")
- end
- local func_wanted= locate(myfunc)[myfuncnumber]; -- remember this is a table
- Env_Dump(func_wanted)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement