User:Lil Toady: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 6: Line 6:
* Optimize destroyElement
* Optimize destroyElement
* Release packets queue after function call
* Release packets queue after function call
===OOP Metatable Structure:===
Element = {
    create = createElement,
    setPosition = setElementPosition,
    ...
}
Vehicle = {
    create = createElement,
    setColor = setVehicleColor,
    ...
}
ElementMT = {
    __index = CLuaClassDefs::Index,
    __newindex = CLuaClassDefs::NewIndex,
    __class = Element,
    __set = {
        type = CLuaClassDefs::ReadOnly,
        health = setElementHealth,
        ...
    },
    __get = {
        type = getElementType,
        health = getElementHealth,
        ...
    },
}
VehicleMT = {
    __index = CLuaClassDefs::Index,
    __newindex = CLuaClassDefs::NewIndex,
    __class = Vehicle,
    __parent = ElementMT,
    __set = {
        damageProof = setVehicleDamageProof
        ...
    },
    __get = {
        damageProof = isVehicleDamageProof
        ...
    },
}

Revision as of 19:51, 26 April 2013

Coder.gif This user is an MTA developer

TODO:

  • OOP tostring
  • OOP vectors
  • Optimize destroyElement
  • Release packets queue after function call

OOP Metatable Structure:

Element = {

   create = createElement,
   setPosition = setElementPosition,
   ...

}

Vehicle = {

   create = createElement,
   setColor = setVehicleColor,
   ...

}

ElementMT = {

   __index = CLuaClassDefs::Index,
   __newindex = CLuaClassDefs::NewIndex,
   __class = Element,
   __set = {
       type = CLuaClassDefs::ReadOnly,
       health = setElementHealth,
       ...
   },
   __get = {
       type = getElementType,
       health = getElementHealth,
       ...
   },

}

VehicleMT = {

   __index = CLuaClassDefs::Index,
   __newindex = CLuaClassDefs::NewIndex,
   __class = Vehicle,
   __parent = ElementMT,
   __set = {
       damageProof = setVehicleDamageProof
       ...
   },
   __get = {
       damageProof = isVehicleDamageProof
       ...
   },

}