I am been coding PHP a fair bit and have just found a function/variable thing that looks like this::
$table->engine
What is this called, I have seen it in IP.Board. (its called the 'registry' there)
I have had a look on google and cant find much.
Posted 29 June 2013 - 05:29 AM
$table->engine
Posted 29 June 2013 - 10:33 AM
Posted 29 June 2013 - 04:48 PM
Xyexs, on 29 June 2013 - 10:33 AM, said:
local object = {
__index = object;
create = function()
local self = {
number = 0;
add = function( self )
self.number = self.number + 1
print( self.number )
return self
end;
subtract = function( self )
self.number = self.number - 3
print( self.number )
return self
end;
}
return setmetatable( self, object )
end
}
local newObject = object.create()
newObject:add():add():subtract()
print( newObject.number )
--#Outputs:
--# The chain:
--# 1 .. 2 .. -1
--# The print:
--# -1
0 members, 2 guests, 0 anonymous users