dm_lua_get Interface

public interface dm_lua_get

Pushes table index on stack and optionally returns value.


Module Procedures

private function lua_get_int32(lua, i, value) result(rc)

Returns 4-byte integer from table element i in value.

The function returns the following error codes:

  • E_EMPTY if the table element of given name is null.
  • E_INVALID if the element on top of the stack is not a table.
  • E_TYPE if the table element is not of type integer.

On error, value will not be overwritten.

Arguments

Type IntentOptional Attributes Name
type(lua_state_type), intent(inout) :: lua

Lua type.

integer, intent(in) :: i

Variable index.

integer, intent(inout) :: value

Variable value.

Return Value integer

private function lua_get_int64(lua, i, value) result(rc)

Returns 8-byte integer from table element i in value.

The function returns the following error codes:

  • E_EMPTY if the table element of given name is null.
  • E_INVALID if the element on top of the stack is not a table.
  • E_TYPE if the table element is not of type integer.

On error, value will not be overwritten.

Arguments

Type IntentOptional Attributes Name
type(lua_state_type), intent(inout) :: lua

Lua type.

integer, intent(in) :: i

Variable index.

integer(kind=i8), intent(inout) :: value

Variable value.

Return Value integer

private function lua_get_logical(lua, i, value) result(rc)

Returns logical from table element i in value.

The function returns the following error codes:

  • E_EMPTY if the table element of given name is null.
  • E_INVALID if the element on top of the stack is not a table.
  • E_TYPE if the table element is not of type boolean.

On error, value will not be overwritten.

Arguments

Type IntentOptional Attributes Name
type(lua_state_type), intent(inout) :: lua

Lua type.

integer, intent(in) :: i

Variable index.

logical, intent(inout) :: value

Variable value.

Return Value integer

private function lua_get_real64(lua, i, value) result(rc)

Returns 8-byte real from table element i in value.

The function returns the following error codes:

  • E_EMPTY if the table element of given name is null.
  • E_INVALID if the element on top of the stack is not a table.
  • E_TYPE if the table element is not of type number.

On error, value will not be overwritten.

Arguments

Type IntentOptional Attributes Name
type(lua_state_type), intent(inout) :: lua

Lua type.

integer, intent(in) :: i

Variable index.

real(kind=r8), intent(inout) :: value

Variable value.

Return Value integer

private function lua_get_stack(lua, i) result(rc)

Pushes table element at index i on stack.

The function returns the following error codes:

  • E_INVALID if the element on top of the stack is not a table.
  • E_EMPTY if the table is empty.

Arguments

Type IntentOptional Attributes Name
type(lua_state_type), intent(inout) :: lua

Lua type.

integer, intent(in) :: i

Variable index.

Return Value integer

private function lua_get_string(lua, i, value, unescape) result(rc)

Returns character string from table element i in value. If unescape is passed and .true., the returned string will have all occurences of \\ replaced by \.

The function returns the following error codes:

  • E_EMPTY if the table element of given name is null.
  • E_INVALID if the element on top of the stack is not a table.
  • E_BOUNDS if the actual string length is greater than the length of the passed value argument.
  • E_TYPE if the table element is not of type string.

On error, value will not be overwritten.

Arguments

Type IntentOptional Attributes Name
type(lua_state_type), intent(inout) :: lua

Lua type.

integer, intent(in) :: i

Variable index.

character(len=*), intent(inout) :: value

Variable value.

logical, intent(in), optional :: unescape

Unescape string.

Return Value integer