Documentation Index
Fetch the complete documentation index at: https://rive-accessibility.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
PropertyList is a mutable list of ViewModel items.
Use it to manage repeating data collections from scripts (for example, menu
items, inventory entries, or dynamic UI rows). A PropertyList supports:
- Reading item count via
length
- 1-based indexed access (
list[1], list[2], …)
- Mutations (
push, insert, swap, pop, shift, clear)
- Change notifications via
addListener and removeListener
For a complete working example, see the Scripting Lists demo.
Fields
length
The current number of items in the list.
function handleSwap(self: MenuListController)
if self.menu and self.menu.length >= 2 then
self.menu:swap(1, 2)
end
end
addListener
Adds a listener that is called when the list changes.
function init(self: MenuListController, context: Context): boolean
local vmi = context:rootViewModel() :: Data.Main
if vmi then
self.menu = vmi.menu
self.listChanged = listChanged
self.menu:addListener(self.listChanged)
else
print('[MenuListController] Warning: Could not find Main ViewModel.')
end
return true
end
removeListener
Removes a previously added list-change listener.
function handleRemoveListener(self: MenuListController)
if self.menu and self.listChanged then
self.menu:removeListener(self.listChanged)
end
end
Methods
push
push(vm: ViewModel) -> ()
Get the list item by index.
function setItemLabel(menu: PropertyList, index: number, label: string)
if index >= 1 and index <= menu.length then
local item = menu[index] :: Data.Button
local itemLabel = item:getString('label')
if itemLabel then
itemLabel.value = label
end
end
end
Adds a view model to the end of the list.
function addButton(menu: PropertyList, label: string)
local buttonVm = Data.Button.new()
local buttonLabel = buttonVm:getString('label')
if buttonLabel then
buttonLabel.value = label
end
menu:push(buttonVm)
end
insert
insert(vm: ViewModel, index: number) -> ()
Inserts a view model at the given index.
function insertAt(menu: PropertyList, label: string, index: number)
local buttonVm = Data.Button.new()
local buttonLabel = buttonVm:getString('label')
if buttonLabel then
buttonLabel.value = label
end
local insertIndex = math.max(1, math.min(index, menu.length + 1))
menu:insert(buttonVm, insertIndex)
end
swap
swap(index1: number, index2: number) -> ()
Swaps the positions of the view models at index1 and index2.
function swapItems(menu: PropertyList, index1: number, index2: number)
local highestIndex = math.max(index1, index2)
if menu and menu.length >= highestIndex then
menu:swap(index1, index2)
end
end
pop
Removes and returns the last view model in the list.
function handlePop(self: MenuListController)
if self.menu then
self.menu:pop()
end
end
shift
Removes and returns the first view model in the list.
function handleShift(self: MenuListController)
if self.menu then
self.menu:shift()
end
end
clear
Removes all view models from the list.
function handleClearItems(self: MenuListController)
if self.menu then
self.menu:clear()
end
end
remove
remove(viewModel: ViewModel) -> ()
Removes a view model from the list.
removeAllOf
removeAllOf(viewModel: ViewModel) -> ()
Removes every list entry that references the given view model instance.
removeAt
removeAt(index: number) -> ()
Removes the view model at the given 1-based index from the list.