mirror of
https://github.com/kikito/middleclass.git
synced 2024-11-08 09:34:22 +00:00
MiddleClass: added parameters to includes/included
This commit is contained in:
parent
df05036c61
commit
5b1a437780
@ -62,12 +62,12 @@ end
|
|||||||
-- Mixin extension function - simulates very basically ruby's include(module)
|
-- Mixin extension function - simulates very basically ruby's include(module)
|
||||||
-- module is a lua table of functions. The functions will be copied to the class
|
-- module is a lua table of functions. The functions will be copied to the class
|
||||||
-- if present in the module, the included() method will be called
|
-- if present in the module, the included() method will be called
|
||||||
Object.includes = function(class, module)
|
Object.includes = function(class, module, ... )
|
||||||
assert(classes[class]~=nil, "Use class:includes instead of class.includes")
|
assert(classes[class]~=nil, "Use class:includes instead of class.includes")
|
||||||
for methodName,method in pairs(module) do
|
for methodName,method in pairs(module) do
|
||||||
if methodName ~="included" then class[methodName] = method end
|
if methodName ~="included" then class[methodName] = method end
|
||||||
end
|
end
|
||||||
if type(module.included)=="function" then module:included(class) end
|
if type(module.included)=="function" then module:included(class, ... ) end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user