enhanced array manipulation code

This commit is contained in:
2020-04-26 15:28:44 +00:00
parent d497e51b62
commit 881dfd2ce0
10 changed files with 286 additions and 284 deletions

View File

@ -78,18 +78,30 @@ function main()
}
{
@local a;
@local a, nil;
a = hawk::array();
a[10] = "good";
a[0][40] = "bye"
a[0][0] = "farewell"
ensure (hawk::typename(a), "array", SCRIPTNAME);
ensure (hawk::typename(a[0]), "array", SCRIPTNAME);
call_by_ref_3(a[9]);
ensure (a[10], "good", SCRIPTNAME);
ensure (a[9], "hello world", SCRIPTNAME);
call_by_ref_3(a[10]);
ensure (a[10], "hello world", SCRIPTNAME);
ensure (a[9], "hello world", SCRIPTNAME);
ensure (a[0][40], "bye", SCRIPTNAME);
call_by_ref_3(a[0][40]);
ensure (a[0][40], "hello world", SCRIPTNAME);
ensure (length(a[0]), 41);
delete a[0][40];
ensure (length(a[0]), 41);
ensure (a[0][0], "farewell", SCRIPTNAME);
ensure (a[0][40], nil, SCRIPTNAME);
#hawk::splice (a[0], 40, 1);
#ensure (length(a[0]), 40);
}
print "SUCCESS"
}