Debian Codegraph @

lua/include/common.lua

raw symbols SCIP
1 --[[
2 Copyright (C) 2014 HarpyWar ([email protected])
3
4 This file is a part of the PvPGN Project http://pvpgn.pro
5 Licensed under the same terms as Lua itself.
6 ]]--
7
8
9 -- Return the script path and line of the CURRENT function where it is executed
10 __FUNCTION__ = nil
11 -- Return the script path and line of the PARENT function where it is executed
12 __function__ = nil
13
14 setmetatable(_G, {__index =
15 function(t, k)
16 if k == '__FUNCTION__' then
17 local w = debug.getinfo(2, "S")
18 return w.short_src..":"..w.linedefined
19 elseif k == '__function__' then
20 local w = debug.getinfo(3, "S")
21 return w.short_src..":"..w.linedefined
22 end
23 end
24 })
25