1 | local dbg = {} |
2 | function getcallingscript() |
3 | local s = debug.info(1, 's') |
4 | for i, v in next, game:GetDescendants() do |
5 | if v:GetFullName() == s then return v end |
6 | end |
7 | return nil |
8 | end |
9 | function dbg.getinfo(thread) |
10 | local CurrentLine = tonumber(debug.info(thread, 'l')) |
11 | local Source = debug.info(thread, 's') |
12 | local name = debug.info(thread, 'n') |
13 | local numparams, isvrg = debug.info(thread, 'a') |
14 | if #name == 0 then name = nil end |
15 | local a, b = debug.info(thread, 'a') |
16 | return { |
17 | ['currentline'] = CurrentLine, |
18 | ['Source'] = Source, |
19 | ['name'] = tostring(name), |
20 | ['numparams'] = tonumber(numparams), |
21 | ['is_vararg'] = isvrg and 1 or 0, |
22 | ['short_src'] = tostring(Source:sub(1, 60)) |
23 | } |
24 | end |
25 | return dbg |