Core Function DllStructGetVars
From Sputnik Wiki
(Difference between revisions)
(Created page with "<pre> DllStructGetVars( <dllstruct> ) </pre> === Description === Create an array of all items and their array size with total byte size === Parameters === ==== dllstruct ===...") |
(→Example) |
||
Line 31: | Line 31: | ||
foreach($vlist as $Name <=> $vData) | foreach($vlist as $Name <=> $vData) | ||
{ | { | ||
− | List( $UBound, $Bytes) = $vData; | + | List( $UBound, $Bytes ) = $vData; |
if($UBound) | if($UBound) | ||
println("DLLStruct item '$Name' has array size of '$UBound' and uses '$Bytes' byte(s) of ram"); | println("DLLStruct item '$Name' has array size of '$UBound' and uses '$Bytes' byte(s) of ram"); |
Revision as of 09:09, 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 size of '" . DLLStructGetVars($a)["test"][0] . "'"); println("DLLStruct item 'test' uses '" . DLLStructGetVars($a)["test"][1] . "' byte(s) of ram");