My mistake, the second one only works in the command line
The first one should work properly though
Its definitely not best practice to use debug functions in your main game script though, I would personally put the function in a table or find some other way to solve the problem (not involving getting the functions name)
Heres code that worked for debug.info just in case
function func()
print("test")
end
print(debug.info(func,"n"))