lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hey all,

Just wondering if anyone else would be interested in a couple of the minor changes I've made to the Lua core,
which essentially allows constructs like this:

 local Box = class{
   classname = "Box",
   inherits = Shape,

   function __init(width, height, depth)
     @width = width
     @height = height
     @depth = depth
   end
 }

to be equivalent to:

 local Box = class{
   classname = "Box",
   inherits = Shape,

   __init = function(self, width, height, depth)
     self.width = width
     self.height = height
     self.depth = depth
   end
 }

The @ symbol is not my idea, I believe there's macros that accomplish much the same thing.

If everybody's happy as is / macros are fine then it saves me the trouble of learning how to use
diff (it probably should be innate knowledge in any programmer.. most embarrassing) and posting
it on the powerpatches page. =)