luav_getItemWithIndex function
The luav_getItemWithIndex function retrieves a value from a Lua table referenced by a LUAVALUE handle, using a numeric index.
This helper is primarily intended for accessing array-like elements of the identifier or options table passed to the FSMDEV_OPEN callback function.
Syntax
LUAVALUE luav_getItemWithIndex(
LUAVALUE lv,
size_t index
);
Parameters
| Parameter | Type | Description |
|---|---|---|
| lv | LUAVALUE | A handle referencing a Lua value expected to be a table. |
| index | size_t | The index of the table element to retrieve. |
Return Values
- If
lvrefers to a Lua table and the specified index exists, returns aLUAVALUEreferencing the corresponding table element. - If the specified index does not exist in the table, returns a
LUAVALUErepresenting Luanil. - If
lvdoes not refer to a Lua table, returns aLUAVALUErepresenting Luanil.
Remarks
- This function performs a read-only table lookup and does not modify the Lua table.
- The returned
LUAVALUEmay represent any Lua value type, includingnil. - To test whether the returned value is
nil, use theluav_isNullfunction. - This function does not raise an error for out-of-range indexes or non-table values; such cases are represented by a
nilLua value. - Lua Value Access Helper functions are not thread-safe; concurrent execution of functions that accept a
LUAVALUEis not allowed. - The lifetime of a
LUAVALUEis limited to the execution of the callback function that received it; accessing it after the callback returns is prohibited.