Software /
code /
prosody
Comparison
util/startup.lua @ 11149:28add4b22a74
util.startup: Retrieve less data for function string representation
debug.getinfo(f) collects more info than what is needed here.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 09 Oct 2020 17:34:04 +0200 |
parent | 11144:2b9f7c537acb |
child | 11150:0cfa36fa707e |
comparison
equal
deleted
inserted
replaced
11148:1dc49accb58e | 11149:28add4b22a74 |
---|---|
195 if name then | 195 if name then |
196 debug.setupvalue(f, i, value); | 196 debug.setupvalue(f, i, value); |
197 end | 197 end |
198 end | 198 end |
199 function mt.__tostring(f) | 199 function mt.__tostring(f) |
200 local info = debug.getinfo(f); | 200 local info = debug.getinfo(f, "S"); |
201 return ("function(%s:%d)"):format(info.short_src:match("[^\\/]*$"), info.linedefined); | 201 return ("function(%s:%d)"):format(info.short_src:match("[^\\/]*$"), info.linedefined); |
202 end | 202 end |
203 debug.setmetatable(function() end, mt); | 203 debug.setmetatable(function() end, mt); |
204 end | 204 end |
205 | 205 |