DE/Boolean

From Multi Theft Auto: Wiki
Revision as of 09:36, 21 August 2012 by Leyynen (talk | contribs) (Created page with "A ''boolean'' or ''bool'' is a datatype whose value can be either ''true'' or ''false''. These are often returned by functions to indicate whether the operation was successful or...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

A boolean or bool is a datatype whose value can be either true or false. These are often returned by functions to indicate whether the operation was successful or not.

Using the lua functions tostring() and type() can help you to find out what datatype something is:

Ein boolean oder bool ist ein Datentyp, dessen Wert entweder true oder false ist. Diese werden häufig durch Funktionen zurückgegeben, um anzuzeigen, ob die Operation erfolgreich war oder nicht.

Mit den Luafunktionen tostring() und type() kann der Datentyp ermittelt werden:

local dieRueckgabe = isPedDead(getRandomPlayer())
outputChatBox("Die Rückgabe war : "..tostring(dieRueckgabe)) -- Entweder "true" oder "false"
outputChatBox("Die Rückgabe dieses Datentyps war: "..type(dieRueckgabe)) -- Es wird "boolean" ausgegeben