isFinal: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - " *\| *([Cc]omments|COMMENTS|Game|[Gg]ame [Nn]ame|Game [Vv]ersion|Game Version \(number surrounded by NO SPACES\)|Multiplayer Arguments( \("local" or "global"\))?|Effects|Multiplayer Effects( \("local" or "global"\))?|Multiplayer Exe...)
mNo edit summary
 
(7 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Command
{{RV|type=command
 
|game1= a3


|game1= arma3
|version1= 2.00
|version1= 2.00


|gr1= Variables
|gr1= Variables


|descr= Checks if [[Code|code]] or a variable was compiled final with [[compileFinal]].
|descr= Checks if [[Code]] or a variable was compiled final with [[compileFinal]].


|s1= [[isFinal]] variable
|s1= [[isFinal]] variable


|p1= varName: [[String]] - A [[String]] pointing to a variable
|p1= variable: [[Code]], [[String]], {{GVI|arma3|2.14|size= 0.75}} [[Array]] or [[HashMap]]
* [[Code]]
* [[String]] - the name of the variable holding [[Code]]
* {{GVI|arma3|2.14|size= 0.75}} [[Array]] - an array that is a [[HashMapKey]], a trigger's <sqf inline>thisList</sqf> array, made final with [[compileFinal]] etc.
* {{GVI|arma3|2.14|size= 0.75}} [[HashMap]] - a hashmap made final with [[compileFinal]]


|r1= [[Boolean]] - [[true]] if final, [[false]] if not
|r1= [[Boolean]] - [[true]] if final, [[false]] if not


|s2= [[isFinal]] code
|x1= <sqf>
 
private _myCode = compileFinal "a = a + 1";
|p21= code: [[Code]] - Some code
systemChat format ["isFinal ""_myCode"": %1", isFinal "_myCode"]; // true
 
systemChat format ["isFinal _myCode: %1", isFinal _myCode]; // true
|r2= [[Boolean]] - [[true]] if final, [[false]] if not
systemChat format ["isFinal some code: %1", isFinal { hint "Hello there" }]; // false


|x1= <code>myCode = [[compileFinal]] "a = a + 1";
private _myArray1 = list _myTrigger;
[[if]] ([[isFinal]] myCode) [[then]] {[[systemChat]] "Code is compiled final."};</code>
systemChat format ["isFinal _myArray1: %1", isFinal _myArray1]; // true


|x2= <code>[[if]] ([[isFinal]] [[BIS_fnc_arsenal]]) then {[[hint]] "You can't edit this function!"};</code>
private _myArray2 = [1, 2, 3];
systemChat format ["isFinal _myArray2: %1", isFinal _myArray2]; // false


|x3= Avoid overwrite .rpt warnings<code>[[if]] (![[isFinal]] fnc_myCode) [[then]] { fnc_myCode = [[compileFinal]] str_myCode };</code>
private _myHashMap = compileFinal createHashMap;
systemChat format ["isFinal _myHashMap: %1", isFinal _myHashMap]; // true
</sqf>


|x2= Avoid .rpt's overwrite warnings:
<sqf>if (!isFinal fnc_myCode) then { fnc_myCode = compileFinal str_myCode };</sqf>


|seealso= [[compile]] [[compileFinal]]
|seealso= [[compile]] [[compileFinal]]
}}
}}

Latest revision as of 03:07, 27 November 2023

Hover & click on the images for description

Description

Description:
Checks if Code or a variable was compiled final with compileFinal.
Groups:
Variables

Syntax

Syntax:
isFinal variable
Parameters:
variable: Code, String, Arma 3 logo black.png2.14 Array or HashMap
Return Value:
Boolean - true if final, false if not

Examples

Example 1:
private _myCode = compileFinal "a = a + 1"; systemChat format ["isFinal ""_myCode"": %1", isFinal "_myCode"]; // true systemChat format ["isFinal _myCode: %1", isFinal _myCode]; // true systemChat format ["isFinal some code: %1", isFinal { hint "Hello there" }]; // false private _myArray1 = list _myTrigger; systemChat format ["isFinal _myArray1: %1", isFinal _myArray1]; // true private _myArray2 = [1, 2, 3]; systemChat format ["isFinal _myArray2: %1", isFinal _myArray2]; // false private _myHashMap = compileFinal createHashMap; systemChat format ["isFinal _myHashMap: %1", isFinal _myHashMap]; // true
Example 2:
Avoid .rpt's overwrite warnings:
if (!isFinal fnc_myCode) then { fnc_myCode = compileFinal str_myCode };

Additional Information

See also:
compile compileFinal

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note