Function Code

Is it possible to get the exact code a function runs? Like ChatPrint, etc?
Sorry this post is so short, but that’s all I have to say >.>

It is possible in some cases, but only if the function was defined in lua.

It only really works with functions defined in real lua files though.

[lua]
function GetSource(func)
local inf = debug.getinfo(func);
if(!inf) then
return “N/A”;
elseif(inf.what == “C”) then
return “C”;
elseif(inf.short_src == “LuaCmd”) then
return “Console/SendLua”;
elseif(inf.short_src == “RunString”) then
return “RunString”;
else
if(file.Exists(inf.short_src,true)) then
return table.concat(string.Explode("
“,file.Read(inf.short_src,true)),”
",inf.linedefined,inf.lastlinedefined);
else
return “NoFile”;
end
end
end
[/lua]

Wow. Thanks a bunch.
So functions like GetPos probably won’t work?

No because they are defined in C.

Figured. Thanks for the help.