Skip to content

Properties

coding_jackalope edited this page Oct 18, 2020 · 4 revisions
Table of Contents

Overview

This is a utility function that will iterate through the given table and create controls and manage the changes made to the values.

local Properties =
{
	String = "Hello World",
	Number = 0.3,
	Boolean = true,
}

Slab.BeginWindow('MyFirstWindow', {Title = "My First Window"})

Slab.Properties(Properties)

Slab.EndWindow()

In version 0.1.0, this function will only do a shallow traversal over the table. There are plans to do a deep traversal through the table with properties put under a proper tree structure for display.

This function allows developers to set options for each property through the 'Options' argument, giving more custom control into how each property is displayed and behaves. The below example shows the same properties as the above example, but giving the 'Number' property a minimum and maximum value.

local Properties =
{
	String = "Hello World",
	Number = 0.3,
	Boolean = true,
}

local Options =
{
	Number = {MinNumber = 0.0, MaxNumber = 100.0}
}

Slab.BeginWindow('MyFirstWindow', {Title = "My First Window"})

Slab.Properties(Properties, Options)

Slab.EndWindow()

API

Below is a list of functions associated with the Properties API.

Properties

Iterates through the table's key-value pairs and adds them to the active window. This currently only does a shallow loop and will not iterate through nested tables.

Parameter Type Description
Table Table The list of properties to build widgets for.
Options Table List of options that can applied to a specific property. The key should match an entry in the 'Table' argument and will apply any additional options to the property control.
Fallback Table List of options that can be applied to any property if an entry was not found in the 'Options' argument.
Clone this wiki locally