mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-21 21:54:35 +00:00
fixed typo in class auto-generation and included call site in auto-generated class name (id often useless)
This commit is contained in:
parent
9597861822
commit
db5351e898
12
class.lua
12
class.lua
@ -64,7 +64,17 @@ local function class(config)
|
|||||||
config = config or {}
|
config = config or {}
|
||||||
local extends = config.extends
|
local extends = config.extends
|
||||||
local implements = config.implements
|
local implements = config.implements
|
||||||
local name = config.name or ("unnamed class %d)"):format(class_id)
|
local src_location = "call location not available"
|
||||||
|
if debug and debug.getinfo then
|
||||||
|
local dinfo = debug.getinfo(2)
|
||||||
|
local src = dinfo.short_src
|
||||||
|
local line = dinfo.currentline
|
||||||
|
src_location = ("%s:%d"):format(src, line)
|
||||||
|
end
|
||||||
|
local name = config.name or ("unnamed class %d (%s)"):format(
|
||||||
|
class_id,
|
||||||
|
src_location
|
||||||
|
)
|
||||||
|
|
||||||
local c = {}
|
local c = {}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user