nil – Talk
Jump to navigation
Jump to search
No edit summary |
Lou Montana (talk | contribs) m (Text replacement - "<code>" to "<code style="display: block">") |
||
(5 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
I did some testing. I think this command should be spelled "nill". "nil" does nothing, while "nill" deletes the variable. This spelling mistake has been around since the OFP scripting reference. --[[User:Maddmatt|Maddmatt]] 15:43, 29 September 2007 (CEST) | I did some testing. I think this command should be spelled "nill". "nil" does nothing, while "nill" deletes the variable. This spelling mistake has been around since the OFP scripting reference. --[[User:Maddmatt|Maddmatt]] 15:43, 29 September 2007 (CEST) | ||
:Are you sure? This works fine: | :Are you sure? This works fine: | ||
:<code>AVAR="A" ; AVAR=Nil ; Hint Format ["Var %1 IsNil %2",AVAR,IsNil "AVAR"];</code> | :<code style="display: block">AVAR="A" ; AVAR=Nil ; Hint Format ["Var %1 IsNil %2",AVAR,IsNil "AVAR"];</code> | ||
:[[User:UNN|UNN]] 20:54, 29 September 2007 (CEST) | :[[User:UNN|UNN]] 20:54, 29 September 2007 (CEST) | ||
:nil is correct. There is nothing like nill. (Because of the way [[Void]] values are handled nill may appear to be working, because it is handled as undefined variable) --[[User:Suma|Suma]] 22:45, 29 September 2007 (CEST) | :nil is correct. There is nothing like nill. (Because of the way [[Void]] values are handled nill may appear to be working, because it is handled as undefined variable) --[[User:Suma|Suma]] 22:45, 29 September 2007 (CEST) | ||
Line 8: | Line 8: | ||
:To avoid further confusion I suggest we use the word [[moot]] instead. --[[User:Doolittle|Doolittle]] 06:17, 2 October 2007 (CEST) | :To avoid further confusion I suggest we use the word [[moot]] instead. --[[User:Doolittle|Doolittle]] 06:17, 2 October 2007 (CEST) | ||
== Return value == | |||
Not sure what's the 'correct' return value: [[Nothing]] or [[Void]] | |||
<br>I think [[Anything]] is definitively wrong, so I changed it back to [[Void]].--[[User:Master85|Master85]] ([[User talk:Master85|talk]]) 17:39, 21 April 2014 (CEST) | |||
<dl class="command_description"> | |||
<dt></dt> | |||
<dd class="notedate">Posted on April 08, 2016 - 21:35 (UTC)</dd> | |||
<dt class="note">'[[User:Pierre MGI|Pierre MGI]]</dt> | |||
<dd class="note"> | |||
To illustrate Mikero's comment: | |||
Destroying a variable doesn't mean the engine "reset" the "container" of the value. | |||
For example, just test: | |||
<pre> | |||
0 = [] spawn { | |||
while {true} do { | |||
sleep 0.5; | |||
if (isNil "my_var") then {my_var = player addAction ["useless action", {}]}; | |||
player removeAction my_var; | |||
hintSilent format ["%1", my_var]; | |||
my_var = nil; | |||
}} | |||
</pre> | |||
Container my_var is still incremented, even if value my_var is voided. | |||
</dd> | |||
</dl> |
Latest revision as of 11:52, 11 January 2023
I did some testing. I think this command should be spelled "nill". "nil" does nothing, while "nill" deletes the variable. This spelling mistake has been around since the OFP scripting reference. --Maddmatt 15:43, 29 September 2007 (CEST)
- Are you sure? This works fine:
AVAR="A" ; AVAR=Nil ; Hint Format ["Var %1 IsNil %2",AVAR,IsNil "AVAR"];
- UNN 20:54, 29 September 2007 (CEST)
- nil is correct. There is nothing like nill. (Because of the way Void values are handled nill may appear to be working, because it is handled as undefined variable) --Suma 22:45, 29 September 2007 (CEST)
Ok thanks for the replies. I just had some weird results earlier. Will try it again.--Maddmatt 23:07, 29 September 2007 (CEST)
- To avoid further confusion I suggest we use the word moot instead. --Doolittle 06:17, 2 October 2007 (CEST)
Return value
Not sure what's the 'correct' return value: Nothing or Void
I think Anything is definitively wrong, so I changed it back to Void.--Master85 (talk) 17:39, 21 April 2014 (CEST)
- Posted on April 08, 2016 - 21:35 (UTC)
- 'Pierre MGI
-
To illustrate Mikero's comment:
Destroying a variable doesn't mean the engine "reset" the "container" of the value.
For example, just test:
0 = [] spawn { while {true} do { sleep 0.5; if (isNil "my_var") then {my_var = player addAction ["useless action", {}]}; player removeAction my_var; hintSilent format ["%1", my_var]; my_var = nil; }}
Container my_var is still incremented, even if value my_var is voided.