mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 06:08:41 +01:00
wrenReturn___() -> wrenSlotSet___().
This turns those functions into general-purpose functions for writing raw C values into slots on the foreign call stack. Writing a return just means writing a value to slot 0.
This commit is contained in:
16
test/api/slots.wren
Normal file
16
test/api/slots.wren
Normal file
@ -0,0 +1,16 @@
|
||||
class Slots {
|
||||
foreign static noSet
|
||||
|
||||
foreign static getSlots(bool, num, string, bytes, value)
|
||||
|
||||
foreign static setSlots(a, b, c, d)
|
||||
}
|
||||
|
||||
// If nothing is set in the return slot, it retains its previous value, the
|
||||
// receiver.
|
||||
System.print(Slots.noSet == Slots) // expect: true
|
||||
|
||||
var value = ["value"]
|
||||
System.print(Slots.getSlots(true, "by\0te", 12.34, "str", value) == value) // expect: true
|
||||
|
||||
System.print(Slots.setSlots(value, 0, 0, 0) == value) // expect: true
|
||||
Reference in New Issue
Block a user