HU/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...")
 
No edit summary
Line 1: Line 1:
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.
A ''boolean'' vagy ''bool'' egy adattípus, melynek értékei lehet ''true'' vagy ''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:
Using the lua functions tostring() and type() can help you to find out what datatype something is:

Revision as of 20:58, 19 July 2018

A boolean vagy bool egy adattípus, melynek értékei lehet true vagy 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:

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