BIS fnc getServerVariable: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (Text replacement - "(\|[pr][0-9]+ *= *[^- ]*) *- *V([a-z ])" to "$1 - v$2")
 
(35 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma3
____________________________________________________________________________________________
|version1= 1.00


| arma3 |= Game name
|gr1= Variables


|1.00|= Game version
|descr= Fetch a variable saved on server.
____________________________________________________________________________________________
Used when you want to share variables only to specific clients to prevent large traffic.
Must be run in [[Scheduler#Scheduled_Environment|scheduled environment]] because communication with server takes some time.


| <pre>/*
|s1= [target, varName, default] call [[BIS_fnc_getServerVariable]]


Description:
|p1= target: [[Namespace]], [[Object]] or [[Group]] - variable name space
Fetch a variable saved on server.
Used when you want to share variables only to specific clients to prevent large traffic.
Must be called in [[Scheduler#Scheduled_Environment|scheduled environment]] because communication with server takes some time.


Parameter(s):
|p2= varName: [[String]] - variable name
0: NAMESPACE or OBJECT or GROUP - variable name space
1: STRING - variable name
2: ANY - default used when variable value is nil


Returns:
|p3= default: [[Anything]] - default value returned when variable is [[nil]]
ANY - variable value
*/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|r1= [[Anything]] - default value or saved variable
____________________________________________________________________________________________


| <!-- [] call [[BIS_fnc_getServerVariable]]; --> |= Syntax
|x1= <sqf>[missionNamespace, "BIS_someVar", "defaultValue"] call BIS_fnc_getServerVariable;</sqf>
 
|p1= |= Parameter 1
 
| |= Return value
____________________________________________________________________________________________
 
|x1= <code></code> |=
____________________________________________________________________________________________
 
| |= See also


|seealso= [[getVariable]] [[setVariable]] [[allVariables]]
}}
}}
<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->
<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Function Group: Variables|{{uc:getServerVariable}}]]
[[Category:Functions|{{uc:getServerVariable}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:getServerVariable}}]]

Latest revision as of 15:53, 8 November 2023

Hover & click on the images for description

Description

Description:
Fetch a variable saved on server. Used when you want to share variables only to specific clients to prevent large traffic. Must be run in scheduled environment because communication with server takes some time.
Execution:
call
Groups:
Variables

Syntax

Syntax:
[target, varName, default] call BIS_fnc_getServerVariable
Parameters:
target: Namespace, Object or Group - variable name space
varName: String - variable name
default: Anything - default value returned when variable is nil
Return Value:
Anything - default value or saved variable

Examples

Example 1:
[missionNamespace, "BIS_someVar", "defaultValue"] call BIS_fnc_getServerVariable;

Additional Information

See also:
getVariable setVariable allVariables

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