Let's say I want to know exactly what the function FindPartOnRay() does, or :FindFirstChild() or whatever, is there a place where I can get exactly the source?
for FFC() it says it in the wiki, but not for the others .-.
Short answer: No.
Long answer: Sort of, but no.
Lua functions are compiled into byte-code when the script first executes. That means the original source is lost. We can see how Lua compiled a particular function using string.dump
. Note that you can't usually print
it because it will include NULL characters.
function hello() local s = "hello" for i = 1, #s do print(s:sub(1, i)) end end print(string.dump(hello))
If you do a little work to hide the bad characters, you'll get this:
LuaQ =Workspace.Script A@ ? Á@ `@?E ?Á@ B @ ? \A _ þ ? hello ð? print sub s (for index) (for limit) (for step) i
It begins with Lua
, then the version number -- Q
is ASCII character 51(hex), meaning this is Lua 5.1 code.
Then it gives the location of the script, Workspace.Script
. (If you compile with your laptop's Lua it would look like @C:\Users\Blu\Desktop\blah.lua
)
There's a bunch of characters strewn throughout that the output doesn't differentiate, but are of course important to Lua.
So, you can sort of get a picture of what happened in hello
based on this dump.
Problem: Lua is an embedded language. It's designed to interface with another, lower level language. In ROBLOX's case, this is C++.
Most "built in functions" are implemented in C or C++. This includes the table
, string
, etc libraries, as well as all of the ROBLOX functions, methods, etc.
If you try to string.dump
them, you'll just get the error
unable to dump given function
in roblox studio, go to the view tab and click on "Object Browser" it shows what everything does in roblox