Dumping Functions Sourcecode

lua-users home
wiki

[Zarutian]: My proposal is to add a way to dump function's source code. That would be useful for debuggers and serilizers.

I have used Tcl for a while and I find the procedure "info body <procedures name>" quite handy and I long for it in Lua.

string.dump(<function)>) could be expanded to string.dump(<function>,<sourcecode?>) and if <sourcecode> is not nil then return the function's source code.

Example:

function bla (n)

  print(n)

end

print(string.dump(bla,true))

would print:

function (n)

  print(n)

end


RecentChanges · preferences
edit · history
Last edited July 7, 2007 7:21 pm GMT (diff)