HU/Boolean

From Multi Theft Auto: Wiki
Revision as of 21:05, 19 July 2018 by Surge (talk | contribs)
Jump to navigation Jump to search

A boolean vagy bool egy adattípus, melynek értéke lehet igaz vagy hamis. Ezeket gyakran a funkciók jelzésére adják vissza, hogy a művelet sikeres volt-e, vagy sem.

A tostring() és type() függvények segíthetnek kideríteni, hogy valami milyen típusú adattípus:

local theReturn = isPedDead(getRandomPlayer())
outputChatBox("The return was: "..tostring(theReturn)) -- Will say: "true" or "false"
outputChatBox("The datatype of this return was: "..type(theReturn)) -- Will say "boolean"


Reversing bools

bool = true
-- if you want to reverse it you can either do
bool = false
-- or
bool = not bool

Fordította

Surge