All pastes #243836 Raw Edit

Untitled

public lua v1 · immutable
#243836 ·published 2006-11-08 22:43 UTC
rendered paste body
-- 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