Skip to content

Instantly share code, notes, and snippets.

@Neztore
Last active March 7, 2020 22:56
Show Gist options
  • Select an option

  • Save Neztore/d69828a36a1da9e1c6192c5569ddc7a3 to your computer and use it in GitHub Desktop.

Select an option

Save Neztore/d69828a36a1da9e1c6192c5569ddc7a3 to your computer and use it in GitHub Desktop.
-- My specific use of https://github.com/Neztore/rbx-tools/blob/master/StringSearch.lua
--[[
Searches all scripts in instance Inst for string Str.
Designed for large workloads - splits search into corotine blocks of 100 items, this will usually be fine.
If you have an absolutely massive (and I mean, really big) game you might want to increase that number.
Neztore 2020
--]]
function search(inst, str)
str = string.lower(str)
local desc = inst:GetDescendants()
for count = 1, #desc, 100 do
local success, errorMessage = coroutine.resume(coroutine.create(function()
local limit = count+100
if limit > #desc then
limit = #desc
end
for inner = count, limit do
wait()
if not desc[inner] then
return warn("Index "..inner.." is nil!")
end
if desc[inner]:isA("Script") then
if desc[inner].Source then
local m, a = string.find(string.lower(desc[inner].Source), str)
if m then
warn("!! Found in "..desc[inner]:GetFullName() .. " at position "..m)
end
else
print(desc[inner]:GetFullName() .. " has no source?")
end
end
end
end))
if not success then warn("Failed to search block "..count .. " to "..count+100) end
end
end
-- Search the entire game for string s.
local s = "accessmanager"
for _, service in pairs(game:GetChildren()) do
local s, e = pcall(function()
local f = coroutine.wrap(function()
search(service, s)
end)
f()
end)
end
print("Searching...")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment