Skip to content

3.09 Element functions

Lokasenna edited this page Jun 24, 2018 · 1 revision

GUI.Val(elm_name[, newval])

Gets or sets an element's value. It's preferred to access element values this way rather than GUI.elms.my_element.retval = 5, as many of classes will need to format their output or sanitize their input.

Required

elm_name    Element name

Optional

newval      New value. Type is determined by each element class. If not specified, the function
            will simply return the current value.

Returned values are of varying types, depending on the element class. See each class's documentation.

GUI.IsInside(elm[, x, y])

Determines if a given position is within the element specified.

Required

elm         A GUI element, or a table containing:
                {x = _, y = _, w = _, h = _}

Optional

x,y         A coordinate pair. If not specified, the mouse position will be used.

Returns a boolean.

GUI.center(elm1[, elm2])

Gives x,y coordinates that would center elm1 within elm2.

Required

elm1        A GUI element, or a table as above.

Optional

elm2        A GUI element, or a table as above. 
            If not specified, elm1 will be centered in the script window.

Returns x,y.