Skip to content

Commit

Permalink
Merge pull request #193 from jvprat/class_tostring
Browse files Browse the repository at this point in the history
Setup __tostring on class creation instead of per instance.
  • Loading branch information
stevedonovan authored Apr 1, 2017
2 parents 41b8368 + 0870bef commit ff65a04
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lua/pl/class.lua
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,6 @@ local function _class(base,c_arg,c)
base._post_init(obj)
end

if not rawget(c,'__tostring') then
c.__tostring = _class_tostring
end
return obj
end
-- Call Class.catch to set a handler for methods/properties not found in the class!
Expand All @@ -194,6 +191,10 @@ local function _class(base,c_arg,c)
c.cast = cast
c._class = c

if not rawget(c,'__tostring') then
c.__tostring = _class_tostring
end

return c
end

Expand Down

0 comments on commit ff65a04

Please sign in to comment.