Core Function DllStructGetVars
From Sputnik Wiki
(Difference between revisions)
(→Example) |
(→Example) |
||
Line 39: | Line 39: | ||
// A more cool way | // A more cool way | ||
− | println("DLLStruct item 'test' has | + | println("DLLStruct item 'test' has UBound of '" . DLLStructGetVars($a)["test"][0] . "'"); |
println("DLLStruct item 'test' uses '" . DLLStructGetVars($a)["test"][1] . "' byte(s) of ram"); | println("DLLStruct item 'test' uses '" . DLLStructGetVars($a)["test"][1] . "' byte(s) of ram"); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
[[Category:Core Function]] | [[Category:Core Function]] |
Revision as of 09:10, 29 November 2011
DllStructGetVars( <dllstruct> )
Contents |
Description
Create an array of all items and their array size with total byte size
Parameters
dllstruct
The DLLStruct to use.
Return Value
Success - Returns the array (hashmap name,key) with keys as the variable names with value as a 2 element array where first is the ubound of the array and second is total bytes used by the item.
Failure - Returns empty array.
Remarks
None
Example
$a = DllStructCreate( "int var1;ubyte var2;int test[700];uint var3;char var4[128]"); $vlist = DLLStructGetVars($a); foreach($vlist as $Name <=> $vData) { List( $UBound, $Bytes ) = $vData; if($UBound) println("DLLStruct item '$Name' has array size of '$UBound' and uses '$Bytes' byte(s) of ram"); else println("DLLStruct item '$Name' is not an array and uses '$Bytes' byte(s) of ram"); } // A more cool way println("DLLStruct item 'test' has UBound of '" . DLLStructGetVars($a)["test"][0] . "'"); println("DLLStruct item 'test' uses '" . DLLStructGetVars($a)["test"][1] . "' byte(s) of ram");