forked from Mirror/wren
- wrenEnsureSlots() Lets you go the foreign slot stack to make room for a temporary work area. - wrenSetSlotNewList() Creates a new empty list and stores it in a slot. - wrenInsertInList() Takes a value from one slot and inserts it into the list in another. Still need more functions like getting elements from a list, removing, etc. but this at least lets you create, populate, and return lists from foreign methods.
11 lines
247 B
Plaintext
11 lines
247 B
Plaintext
class Lists {
|
|
foreign static newList()
|
|
foreign static insert()
|
|
}
|
|
|
|
var list = Lists.newList()
|
|
System.print(list is List) // expect: true
|
|
System.print(list.count) // expect: 0
|
|
|
|
System.print(Lists.insert()) // expect: [4, 5, 6, 1, 2, 3, 9, 8, 7]
|