Add helper for javascript typed arrays

For scalar vector fields, emit an Array helper that
returns a typed array view of the underlying bytes buffer.
This commit is contained in:
Robert Nix
2016-02-12 12:27:28 -06:00
parent 2f5d7ae645
commit 9d92aeb182
3 changed files with 44 additions and 1 deletions

View File

@@ -105,6 +105,13 @@ function testBuffer(bb) {
}
assert.strictEqual(invsum, 10);
var invsum2 = 0;
var invArr = monster.inventoryArray();
for (var i = 0; i < invArr.length; i++) {
invsum2 += invArr[i];
}
assert.strictEqual(invsum2, 10);
var test_0 = monster.test4(0);
var test_1 = monster.test4(1);
assert.strictEqual(monster.test4Length(), 2);