matthewdean / roblox-global-variable-enumerator

Lists all RBX.Lua global variables
MIT License
5 stars 0 forks source link

How to solve issues with this repo #1

Open OverHash opened 4 years ago

OverHash commented 4 years ago

So today I needed a list of all global variables for a specific reason, and I found this. Unfortunately, there are a few problems with this app that prevent it from working, here's my workarounds for anyone in the future!

Line 19 erroring in Program.cs

This is because the system registry lookup is wrong to get the version hash, change line 18 to the following:

var studioVersionHash = (string) Registry.GetValue(@"HKEY_CURRENT_USER\Software\ROBLOX Corporation\Environments\roblox-studio", "version", null);

System.Web.Helpers doesn't exist

Microsoft seemed to just move this library to a Nuget package called "[microsoft-web-helpers](Install-Package microsoft-web-helpers -Version 2.1.20710.2)". Installing that package seems to be equivalent to having the assembly. To install this, just run

Install-Package microsoft-web-helpers -Version 2.1.20710.2

in the package manager view (you should be able to open this via the bottom left of your screen)!

The app now runs, but it does nothing?

Not sure why this is happening, maybe some things internally in Roblox have changed. Anyway, there is a way around!

Extracting the candidates

The app will still create the JSON file of all possible candidates in your InstalledPlugins folder (This is accessible by going to file explorer and navigating to

%localappdata%/Roblox/InstalledPlugins/0

and then opening the settings.json file.

Sorting the candidates

Now, open a baseplate file and create a ModuleScript in ServerScriptService. First, type

return [[

and then paste that big long JSON file into the script. it will probably lag, you just have to endure the pain. Once it's pasted, go to the end of the file and close the JSON data with another ```lua ]]

The script should now look like the following:
```lua
return [[{"Candidates": [LOTS_OF_STUFF]}]]

Now, run this script in command bar:

local candidates = game.HttpService:JSONDecode(require(game.ServerScriptService.ModuleScript:Clone()))
local globalEnvironment = getfenv()
local globalVariables = {}
for _, identifier in pairs(candidates.Candidates) do
    if globalEnvironment[identifier] ~= nil then
        table.insert(globalVariables, identifier)
    end
end

local str = ''
for _, global in pairs(globalVariables) do
    str = str..global..' = '..global..','
end
str = str:sub(1, #str-1)

print(str)

this should print all the globals available, comma separated!


I should be active on my GitHub account for a few more years, so please comment on this issue, or contact me on other social media platforms if you have a question regarding this app!

To @matthewdean, you might want to consider fixing some of those problems above. As this is an old repository, it's understandable if you want to leave it in it's current state!

matthewdean commented 4 years ago

Thanks for posting about this. I did a bit of digging and looks like the -script argument to RobloxStudioBeta.exe doesn't work anymore. I'm not actively maintaining this repository but if anyone can figure out how to run Lua code automatically would love to see if we can update this and get it working again.