From Multi Theft Auto: Wiki
Jump to navigation
Jump to search
|
|
| Line 1: |
Line 1: |
| __NOTOC__
| |
| {{Useful Function}}
| |
| This function returns the current month name.
| |
|
| |
|
| '''Author:''' N3xT
| |
|
| |
| ==Syntax==
| |
| <syntaxhighlight lang="lua">
| |
| string getRealMonth()
| |
| </syntaxhighlight>
| |
|
| |
| ==Returns==
| |
| This function returns a string containing the real month name
| |
|
| |
| ==Code==
| |
| <section name="Function source" class="both" show="true">
| |
| <syntaxhighlight lang="lua">
| |
| local monthsTable = {
| |
| [1] = "January",
| |
| [2] = "February",
| |
| [3] = "March",
| |
| [4] = "April",
| |
| [5] = "May",
| |
| [6] = "June",
| |
| [7] = "July",
| |
| [8] = "August",
| |
| [9] = "September",
| |
| [10] = "October",
| |
| [11] = "November",
| |
| [12] = "December"
| |
| }
| |
|
| |
| function getRealMonth()
| |
| local time = getRealTime()
| |
| local month = time.month + 1
| |
| return monthsTable[month]
| |
| end
| |
| </syntaxhighlight>
| |
| </section>
| |
|
| |
| ==Example==
| |
| <section name="Clientside example" class="client" show="true">
| |
| This example output the real month.
| |
| <syntaxhighlight lang="lua">
| |
| addCommandHandler("realMonth",
| |
| function()
| |
| local realMonth = getRealMonth()
| |
| outputChatBox(realMonth, 255, 0, 0)
| |
| end
| |
| )
| |
| </syntaxhighlight>
| |
| </section>
| |
|
| |
| ==See also==
| |
| {{Useful_Functions}}
| |
Latest revision as of 14:28, 23 May 2021