-- Your script nameyourscript = {}-- Local table - other scripts don't see this, will contain our methods (object functions)local m = {}-- msg method (obj:msg())-- self is "obj"function m:msg () _Msg(self.name.." says hello!")end-- Function to create objectsfunction yourscript.new (name) local o = {} o.name = name -- You can ignore this stuff - it works local mt = {} mt.__index = m setmetatable(o, mt)end-- Example:obj = yourscript.new("Anders")obj:msg() -- Will print "Anders says hello" in console