DE/Boolean: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(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...")
(No difference)

Revision as of 09:36, 21 August 2012

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