File size: 406 Bytes
402daee
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--[[

  Polo.lua - Plain Old Lua Object (POLO) class generator

]]--

function Polo(definition)
  definition.__index = definition

  local new_override = definition.new

  definition.new = function(...)
    local o = new_override and new_override(...) or ... or {}
    assert(type(o) == 'table')

    setmetatable(o, definition)
    if o.init then o:init() end

    return o
  end

  return definition
end