Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions 30log-clean.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ local function extend(self, name, extra_params)
_classes[heir] = tostring(heir)
self.__subclasses[heir] = true
deep_copy(extra_params, deep_copy(self, heir))
heir.name = extra_params and extra_params.name or name
heir.className = extra_params and extra_params.name or name
heir.__index = heir
heir.super = self
heir.mixins = {}
Expand All @@ -79,11 +79,11 @@ baseMt = {

__tostring = function(self,...)
if _instances[self] then
return ("instance of '%s' (%s)"):format(rawget(self.class,'name')
return ("instance of '%s' (%s)"):format(rawget(self.class,'className')
or '?', _instances[self])
end
return _classes[self]
and ("class '%s' (%s)"):format(rawget(self,'name')
and ("class '%s' (%s)"):format(rawget(self,'className')
or '?',
_classes[self]) or self
end
Expand All @@ -100,7 +100,7 @@ local class = {
_class = function(name, attr)
local c = deep_copy(attr)
_classes[c] = tostring(c)
c.name = name or c.name
c.className = name or c.name
c.__tostring = baseMt.__tostring
c.__call = baseMt.__call
c.new = bind(instantiate, true)
Expand Down Expand Up @@ -207,4 +207,4 @@ class._VERSION = '30log v1.3.0'
class._URL = 'http://github.com/Yonaba/30log'
class._LICENSE = 'MIT LICENSE <http://www.opensource.org/licenses/mit-license.php>'

return setmetatable(class,{__call = function(_,...) return _class(...) end })
return setmetatable(class,{__call = function(_,...) return _class(...) end })