Advertisement
Guest User

Untitled

a guest
May 22nd, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.40 KB | None | 0 0
  1. function load(class, ...)
  2.     assert(type(class) == "table", "first argument provided to load is not a table")
  3.     local instance = setmetatable( { },
  4.         {
  5.             __index = class;
  6.             __super = { class };
  7.             __newindex = class.__newindex;
  8.             __call = class.__call;
  9.         })
  10.    
  11.     -- Call load
  12.     if rawget(class, "load") then
  13.         rawget(class, "load")(instance, ...)
  14.     end
  15.     instance.load = false
  16.  
  17.     return instance
  18. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement