Fandom

武装突袭 Wiki

Void

简体 | 繁體

4,827个页面创建
于此维基上
添加新页面
评论0 分享

您使用了广告屏蔽软件!


Wikia通过广告运营为用户提供免费的服务。我们对用户通过嵌入广告屏蔽软件访问网站进行了使用调整。

如果您使用了广告屏蔽软件,将无法使用我们的服务。请您移除广告屏蔽软件,以确保页面正常加载。

A variable of type Void is an undefined variable.

Undefining Variables 编辑

You can use nil to undefine variables.

myVar = 1;
...
myVar = nil;

myVar => undefined

Comparisons 编辑

No comparison with variables of this type will work.

Example:

// error
if (undefinedVar == ...) then ...
// error
if (undefinedVar == undefinedVar) then ...


In Operation Flashpoint, a Variable becomes undefined when it is assigned to an undefined value, or an expression which refers to an undefined value somewhere.

Names编辑

The String representation of an undefined variable is one of the following:

Anything: scalar bool array string 0xfcffffef (OFP)

Anything: scalar bool array string 0xe0ffffef (ArmA)

Nothing: scalar bool array string nothing 0xfcffffef

Number: scalar

Boolean: bool

Array: array

Caution: the string specification of the undefined variables is undocumented, and it is very likely to change in future version of the scripting language.

The reliable way to check if the variable is undefined is that it silently fails any expression evaluations on it.

Example:

defined=false;if var==var then {defined=true};if var!=var then {defined=true};
if !defined then {/*we know it is undefined here*/}

The code above should not work in ArmA 2, as stated here.

In Armed Assault or later isNil is the preferred way to check for this, like

 isNil "varName"

Type Inference编辑

Suppose the variable a is undefined, and we set the variable b like so:
b = a + []

The inferred type of b is now array - since b was the product result of an array add operation with a definite array ([]) and an unknown type (a)

b's string representation will now be 'array', and b wil be considered an undefined array.

更多维基

随机维基