2,736
edits
Red Leader (talk | contribs) (→tilePath(): Finish docing) |
Red Leader (talk | contribs) (→tilePath(): Doc values(). All global function now finished! :)) |
||
| Line 2,154: | Line 2,154: | ||
|text = Returns the base path of the tile at the aircraft's current position as a string. For example, at KSFO, this would be <code>w130n30/w123n3</code>, corresponding to <tt>''[[$FG_SCENERY]]/Terrain/w130n30/w123n3''</tt>. | |text = Returns the base path of the tile at the aircraft's current position as a string. For example, at KSFO, this would be <code>w130n30/w123n3</code>, corresponding to <tt>''[[$FG_SCENERY]]/Terrain/w130n30/w123n3''</tt>. | ||
|example1 = print(tilePath()); # print path | |example1 = print(tilePath()); # print path | ||
}} | |||
=== values() === | |||
{{Nasal doc | |||
|syntax = values(hash); | |||
|source = {{fgdata file|Nasal/globals.nas|t=Source}} | |||
|text = Returns a vector containing the values of the given hash. | |||
|param1 = hash | |||
|param1text = Mandatory hash to get the values of. | |||
|example1 = var hash = { | |||
"a": 1, | |||
"b": 2, | |||
"c": 3 | |||
}; | |||
foreach(var val; values(hash)){ | |||
print(val); | |||
} | |||
|example2text = The below example does exactly the same thing as the above example, but does not use <code>values()</code>: | |||
|example2 = var hash = { | |||
"a": 1, | |||
"b": 2, | |||
"c": 3 | |||
}; | |||
foreach(var key; keys(hash)){ | |||
print(hash[key]); | |||
} | |||
}}<!-- | }}<!-- | ||