Skip to content

Instantly share code, notes, and snippets.

@EspressoCake
Created January 6, 2022 19:57
Show Gist options
  • Save EspressoCake/612c8fa45e6d608ec0811ef747cf1db7 to your computer and use it in GitHub Desktop.
Save EspressoCake/612c8fa45e6d608ec0811ef747cf1db7 to your computer and use it in GitHub Desktop.
# For Bobby Cooke :)
sub returnIntegerFromArray {
local('@cArray');
local('$cVal');
local('$cIndex');
$cVal = 0;
if ((size(@_) == 1) && (size($1) == 4)) {
@cArray = reverse($1);
foreach $cIndex (@cArray) {
$cVal = ($cVal << 8) + ($cIndex & 0xFF);
}
println("Array integer value: " . $cVal);
}
}
# Example mock data, view in "Script Console"
returnIntegerFromArray(@(214, 188, 3, 0));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment