Skip to content

Instantly share code, notes, and snippets.

@badcc
Last active December 20, 2015 03:56
Show Gist options
  • Select an option

  • Save badcc/32fb7333daf11fec1be5 to your computer and use it in GitHub Desktop.

Select an option

Save badcc/32fb7333daf11fec1be5 to your computer and use it in GitHub Desktop.
local HttpService = game:GetService('HttpService')
local apid = HttpService:JSONDecode(HttpService:GetAsync('http://anaminus.github.io/rbx/json/api/latest.json'))
local function CoreDump(Reference, ClassName)
ClassName = ClassName or Reference.ClassName
print('Dump: ' .. ClassName)
local Table,LongestKey = {}, 0
for _,Entry in next,apid do
if (Entry.type == 'Property' and Entry.Class == ClassName) then
local Skip = false
for _,Tag in next,Entry.tags do
if (Tag == 'RobloxPlaceSecurity' or Tag == 'PluginSecurity' or Tag == 'deprecated' or Tag == 'hidden') then
Skip = true
break
end
end
if (not Skip) then
Table[Entry.Name] = Reference[Entry.Name]
local KeyLength = #Entry.Name
if (KeyLength > LongestKey) then
LongestKey = KeyLength
end
end
elseif (Entry.type == 'Class' and Entry.Name == ClassName and Entry.Superclass) then
local rTable, rLongestKey = CoreDump(Reference, Entry.Superclass)
for Key,Value in next,rTable do
Table[Key] = Value
end
if (rLongestKey > LongestKey) then
LongestKey = rLongestKey
end
end
end
return Table, LongestKey
end
local function Dump(Reference)
-- Formatting that only looks
-- good with monospaced fonts.
local q=tick()
local f,g=CoreDump(Reference)
local r,s=math.floor((g-3)*0.5),math.floor((g-5)*0.5)
print(('-'):rep(r),'key',('-'):rep(r-1)..'T'..('-'):rep(s),'value',('-'):rep(s-1))
for o,p in next,f do print(o..(' '):rep(g-#o)..'|',p) end
print(('-'):rep(g*2))
print('Done',math.floor((tick()-q)*1000),'ms')
end
-- EXAMPLE --
-- Dump(game.Workspace.Baseplate)
Dump: Part
Dump: FormFactorPart
Dump: BasePart
Dump: PVInstance
Dump: Instance
---------- key ---------T--------- value --------
RightParamB | 0.5
TopSurfaceInput | Enum.InputType.NoInput
CFrame | 0, -10, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1
FrontSurfaceInput | Enum.InputType.NoInput
BottomParamB | 0.5
FormFactor | Enum.FormFactor.Symmetric
FrontParamB | 0.5
BottomSurfaceInput | Enum.InputType.NoInput
CanCollide | true
BackSurfaceInput | Enum.InputType.NoInput
LeftSurface | Enum.SurfaceType.Smooth
Elasticity | 0.5
FrontParamA | -0.5
ClassName | Part
BackParamB | 0.5
TopSurface | Enum.SurfaceType.Studs
Locked | true
ResizeableFaces | Right, Top, Back, Left, Bottom, Front
Reflectance | 0
Transparency | 0
Parent | Workspace
TopParamB | 0.5
Velocity | 0, 0, 0
SpecificGravity | 0.69999998807907
ResizeIncrement | 1
Name | BasePlate
RotVelocity | 0, 0, 0
RightSurface | Enum.SurfaceType.Smooth
BottomParamA | -0.5
Material | Enum.Material.Plastic
Archivable | true
Size | 512, 20, 512
BackSurface | Enum.SurfaceType.Smooth
FrontSurface | Enum.SurfaceType.Smooth
RightSurfaceInput | Enum.InputType.NoInput
BackParamA | -0.5
TopParamA | -0.5
LeftParamB | 0.5
Anchored | true
RightParamA | -0.5
Rotation | -0, 0, -0
LeftSurfaceInput | Enum.InputType.NoInput
BrickColor | Dark stone grey
Position | 0, -10, 0
BottomSurface | Enum.SurfaceType.Inlet
LeftParamA | -0.5
Shape | Enum.PartType.Block
Friction | 0.30000001192093
------------------------------------------------
Done 9 ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment