Skip to content

Instantly share code, notes, and snippets.

@Sleitnick
Last active June 13, 2026 05:03
Show Gist options
  • Select an option

  • Save Sleitnick/1c0108dda19040e54bd146564a4a95e8 to your computer and use it in GitHub Desktop.

Select an option

Save Sleitnick/1c0108dda19040e54bd146564a4a95e8 to your computer and use it in GitHub Desktop.
GenerateServicesTable.luau
-- Run this script in the command bar. It will generate a table of services that
-- are relevant to Roblox game devs, e.g. it has permitted methods/properties/events.
const ReflectionService = game:GetService("ReflectionService")
const start = os.clock()
const classes = ReflectionService:GetClasses()
const services: { string } = {}
const filtered: { string } = {}
const function hasSomePermittedItems(items: { { Permits: { [any]: any } } }): boolean
for _, item in items do
if next(item.Permits) then
return true
end
end
return false
end
for _, cls in classes do
if cls.Permits.GetService ~= nil and (cls.Display and cls.Display.DeprecationMessage == nil) then
local filter = { ExcludeInherited = true, ExcludeDisplay = true }
const methods = ReflectionService:GetMethodsOfClass(cls.Name, filter)
if not hasSomePermittedItems(methods) then
const events = ReflectionService:GetEventsOfClass(cls.Name, filter)
if not hasSomePermittedItems(events) then
const properties = ReflectionService:GetPropertiesOfClass(cls.Name, filter)
if not hasSomePermittedItems(properties) then
table.insert(filtered, cls.Name)
continue
end
end
end
table.insert(services, `\t"{cls.Name}",`)
end
end
const dur = os.clock() - start
print(string.format("Duration: %.3fms", dur * 1000))
print("FILTERED OUT", filtered)
print("\nconst services = table.freeze({\n" .. table.concat(services, "\n") .. "\n})\n")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment