Template:OOP: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(Removed Russian template from English one)
 
(30 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<includeonly>
<includeonly>
<div style="border: 1px solid #AFAFAF; border-right: 5px dotted #AFAFAF; background: #FFFF99; float: right; width: 400px; padding: 3px; margin: 5px; margin-right: 0px;">
<u>'''OOP Syntax'''</u> <small>[[OOP Introduction|Help! I don't understand this!]]</small>
<u>'''OOP Syntax'''</u>
{{#if: {{{1|}}} |: '''Note''': ''{{{1}}}''|}}{{#if: {{{2|}}} |: '''Method''': ''{{{2}}}(...)''|}}{{#if: {{{3|}}} |: '''Variable''': ''.{{{3}}}''|}}{{#if: {{{4|}}} |: '''Counterpart''': ''[[{{{4}}}]]''|}}
{{#if: {{{1|}}} |: Note: {{{1}}}|}}
</includeonly>
{{#if: {{{2|}}} |: Name: {{{2}}}|}}
<noinclude>
{{#if: {{{3|}}} |: Variable: '''{{{3}}}''|}}
{{Template documentation|Template for OOP (object orientated programming)|
{{#if: {{{4|}}} |: Pair: [[{{{4}}}]]|}}</div></includeonly><noinclude>
{{OOP|Set the variable to nil to execute [[removePedFromVehicle]]|[[ped]]:warpIntoVehicle|vehicle|getPedOccupiedVehicle}}
{{OOP|This function has been dropped in favour of [[setPlayerHudComponentVisible]] | getRandom() | .random | isPlayerHudComponentVisible}}
 
<syntaxhighlight lang="lua">{{OOP|Set the variable to nil to execute [[removePedFromVehicle]]|[[ped]]:warpIntoVehicle|vehicle|getPedOccupiedVehicle}}
</syntaxhighlight>
 
Hey guys, here are a few "rules" in using the OOP template:
* If it's a constructor, such as [[createPed]], use "[[Ped]]" not "createPed" or "Ped.create"
* If it's a static class function or a constructor, use a capital letter for the first character. (Player not player).
* Likewise, if it's an object function such as "player:setName", use lowercase.
* Use full stops (or if you're american, "periods.") for static functions and colons (:) for object functions.
}}
</noinclude>
</noinclude>

Latest revision as of 10:30, 1 August 2023


Applications-office.pngTemplate Documentation

Template for OOP (object orientated programming)

Usage


OOP Syntax Help! I don't understand this!

Note: Set the variable to nil to execute removePedFromVehicle
Method: ped:warpIntoVehicle(...)
Variable: .vehicle
Counterpart: getPedOccupiedVehicle


{{OOP|Set the variable to nil to execute [[removePedFromVehicle]]|[[ped]]:warpIntoVehicle|vehicle|getPedOccupiedVehicle}}

Hey guys, here are a few "rules" in using the OOP template:

  • If it's a constructor, such as createPed, use "Ped" not "createPed" or "Ped.create"
  • If it's a static class function or a constructor, use a capital letter for the first character. (Player not player).
  • Likewise, if it's an object function such as "player:setName", use lowercase.
  • Use full stops (or if you're american, "periods.") for static functions and colons (:) for object functions.