What in god's name is the debug.dumprefs function?

While playing around the Roblox Luau Environment, I came across a function in the debug library that I can’t find any information about:

debug.dumprefs() seems to take a string as an argument, but no idea what type of string it wants, what it’s used for and what is its purpose.

Does anyone know any information about this function? I randomly came across this and got curious. Thanks!

2 Likes

Not documented but the name implies “dump references” which probably refers to displaying current references.

1 Like

Calling the function and passing no arguments does not dump the current references, and returns nothing. Attempting to pass any argument will make it throw an error saying that it expects a string, but I can’t guess what kind of string it wants. Putting random strings throws the error “unknown target”

1 Like

Try one of the letters: s l n a f
Not alltogether, only one, like "f"

1 Like

It seems that the function returns some active references depending on whatever script context you provide it, “game” “plugin” or “core”

See below:

Inside each table lists where the references are coming from.

1 Like

That’s actually pretty sweet. I wish we could get references per closure/thread, but I guess there is no tag on the reference to tell what’s using it.

It might be possible to isolate scripts by forcing them to run on different actors, though.

1 Like


Yea, this is the most information you can really get from it. You can deduce what function it is coming from by line number, but I don’t think you can get actual closure objects or threads, unfortunately. I don’t think you can even use this function by default (at least I couldn’t in up to date studio, I don’t know about actual roblox).

image
Normally outputs this

3 Likes

It is disabled by default in the Roblox client:

Perhaps it can be toggled with an FFlag. I’m not sure though, I don’t know how I can even call the function in studio. The only difference with my Roblox Studio compared to others is this in the image below, but other than that, I don’t know.

Yea maybe, I didn’t really look into it much. I just used a debugger to quickly patch relevant instructions to stop the check from proceeding. It’s not intended to be used outside of roblox internal operations clearly.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.