test.lua文件内容
function getFileName(File)
local ret = string.find(string.reverse(File), "/")
if ret == nil then
return File
end
local Len = string.len(File) - ret + 1
return string.sub(File, Len + 1, string.len(File))
end
FileName = string.format("%s:%d", getFileName(debug.getinfo(1).short_src), debug.getinfo(1).currentline)
print (FileName)
--原文件路径与行号信息
print ("Name: "..debug.getinfo(1).short_src)
print ("Line: "..debug.getinfo(1).currentline)
function getFileName(File)