Logo
Explore Mail Help
Register Sign In
Mirror/wren
1
0
Fork 1
You've already forked wren
mirror of https://github.com/wren-lang/wren.git synced 2026-01-12 14:48:40 +01:00
Code Issues Packages Projects Releases Wiki Activity
Files
stack-corruption-fix
wren/test/api/lists.wren

11 lines
247 B
Plaintext
Raw Permalink Normal View History

Add C API functions for working with lists: - 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.
2015-12-16 16:28:26 -08:00
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]
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.24.0 Page: 1073ms Template: 2ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API