DVUI

dataGetSliceDefault

Retrieve slice contents for key (id+name).

If the key doesn't exist yet, store the default slice into internal storage, and then return the internal storage slice.

Can be called from any thread.

If called from non-GUI thread or outside Window.begin/Window.end, you must pass a pointer to the Window you want to add the value to.

The returned slice points to internal storage, which will be freed after a frame where there is no call to any dataGet/dataSet functions for this key.

The slice will always be valid until the next call to Window.end.

Parameters

#
win:?*Window
?*Window
id:Id
Id
name:[]const u8
[]const u8
T:type
type
default:[]const @typeInfo(T).pointer.child
[]const @typeInfo(T).pointer.child

Source

Implementation

#
pub fn dataGetSliceDefault(win: ?*Window, id: Id, name: []const u8, comptime T: type, default: []const @typeInfo(T).pointer.child) T {
    return data.getSliceDefault(win, .widget(id, name), T, default);
}