Advertisement
DrawingJhon

Roblox Properties Objects

Aug 4th, 2020 (edited)
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.00 KB | None | 0 0
  1.  local ClassProperties do
  2.     -- ClassProperties is a Dictionary of sorted arrays of Properties of Classes
  3.     -- Pulls from anaminus.github.io
  4.     -- Ignores deprecated and RobloxPluginSecurity Properties
  5.     -- Make sure HttpService is Enabled (Roblox Studio -> Home Tab -> Game Settings -> Security -> Allow HTTP requests = "On")
  6.  
  7.     ClassProperties = {}
  8.     local HttpService = game:GetService("HttpService")
  9.  
  10.     local Data = HttpService:JSONDecode(HttpService:GetAsync("https://anaminus.github.io/rbx/json/api/latest.json"))
  11.  
  12.     for i = 1, #Data do
  13.         local Table = Data[i]
  14.         local Type = Table.type
  15.  
  16.         if Type == "Class" then
  17.             local ClassData = {}
  18.  
  19.             local Superclass = ClassProperties[Table.Superclass]
  20.  
  21.             if Superclass then
  22.                 for j = 1, #Superclass do
  23.                     ClassData[j] = Superclass[j]
  24.                 end
  25.             end
  26.  
  27.             ClassProperties[Table.Name] = ClassData
  28.         elseif Type == "Property" then
  29.             if not next(Table.tags) then
  30.                 local Class = ClassProperties[Table.Class]
  31.                 local Property = Table.Name
  32.                 local Inserted
  33.  
  34.                 for j = 1, #Class do
  35.                     if Property < Class[j] then -- Determine whether `Property` precedes `Class[j]` alphabetically
  36.                         Inserted = true
  37.                         table.insert(Class, j, Property)
  38.                         break
  39.                     end
  40.                 end
  41.  
  42.                 if not Inserted then
  43.                     table.insert(Class, Property)
  44.                 end
  45.             end
  46.         elseif Type == "Function" then
  47.         elseif Type == "YieldFunction" then
  48.         elseif Type == "Event" then
  49.         elseif Type == "Callback" then
  50.         elseif Type == "Enum" then
  51.         elseif Type == "EnumItem" then
  52.         end
  53.     end
  54. end
  55.  
  56. --table.foreach(ClassProperties["Part"], print)
  57. for i, v in pairs(ClassProperties["Part"]) do
  58.  print(v)
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement