Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Lua by nya ( 17 years ago )
--Script start
io.write("OOP scripting in lua
")
--Declaring base(root) classs
Base = {}
--Constructor
function Base:New()
local obj = {}
setmetatable(obj,self)
self.__index = self
return obj
end
--Destructor
function Base:Del()
setmetatable(self,nil)
self = nil
return self
end
--Method
function Base:getbody()
print(self.body)
end
function Base:Hello()
print("Hello!")
end
--###########################
object = Base:New()
object.body = "Attribute"
object:getbody()
another = object:New()
another:Hello()
another = another:Del()
another:Hello()
Revise this Paste