From 7bb5ca747faec42e260353e3aa689f3ec7178991 Mon Sep 17 00:00:00 2001 From: ldurniat Date: Sun, 10 Dec 2017 17:01:45 +0100 Subject: [PATCH] A variable 'name' replace with a name 'className' Hi, I found that variable 'name' collide with my own variable with the same name. So I changed it to something more specific like 'className'. That is all. Have a nice day:) ldurniat --- 30log-clean.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/30log-clean.lua b/30log-clean.lua index 398f7b4..1cf91ac 100644 --- a/30log-clean.lua +++ b/30log-clean.lua @@ -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 = {} @@ -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 @@ -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) @@ -207,4 +207,4 @@ class._VERSION = '30log v1.3.0' class._URL = 'http://github.com/Yonaba/30log' class._LICENSE = 'MIT LICENSE ' -return setmetatable(class,{__call = function(_,...) return _class(...) end }) \ No newline at end of file +return setmetatable(class,{__call = function(_,...) return _class(...) end })