luav_asString function
The luav_asString function retrieves the Lua string value referenced by a LUAVALUE handle as a C-style string.
This helper is intended for reading string-based configuration or identifier values passed to plugin callbacks such as FSMDEV_OPEN, without using the Lua C API directly.
Syntax
const char* luav_asString(
LUAVALUE lv
);
Parameters
| Parameter | Type | Description |
|---|---|---|
| lv | LUAVALUE | A handle referencing a Lua value to be interpreted as a string. |
Return Values
- If the referenced Lua value is a string, returns a pointer to a null-terminated UTF-8 string.
- If the referenced Lua value is not a string, returns a null pointer.
Remarks
- This function does not perform type conversion; only Lua string values are accepted.
- Callers should check the return value for a null pointer before using the returned string.
- The returned string pointer is owned by the Lua runtime and must not be modified or freed by the plugin.
- The lifetime of the returned string is limited to the execution of the callback function that received the
LUAVALUEhandle. - 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.