dm_lua_field Interface

public interface dm_lua_field

Pushes table element on stack and optionally returns value.

Called by

interface~~dm_lua_field~~CalledByGraph interface~dm_lua_field dm_lua_field proc~dm_config_field dm_config_field proc~dm_config_field->interface~dm_lua_field

Module Procedures

private function lua_field_array_int32(lua, name, values) result(rc)

Returns allocatable 4-byte integer array from table field name in values.

The function returns the following error codes:

  • E_ALLOC if array allocation failed.
  • E_EMPTY if the field of given name is null.
  • E_TYPE if the field is not an integer array.

On error, values will be allocated but empty.

Arguments

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

Lua type.

character(len=*), intent(in) :: name

Table field name.

integer(kind=i4), intent(out), allocatable :: values(:)

Table field values.

Return Value integer

private function lua_field_array_int64(lua, name, values) result(rc)

Returns allocatable 8-byte integer array from table field name in values.

The function returns the following error codes:

  • E_ALLOC if array allocation failed.
  • E_EMPTY if the field of given name is null.
  • E_TYPE if the field is not an integer array.

On error, values will be allocated but empty.

Arguments

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

Lua type.

character(len=*), intent(in) :: name

Table field name.

integer(kind=i8), intent(out), allocatable :: values(:)

Table field values.

Return Value integer

private function lua_field_array_string(lua, name, values, unescape) result(rc)

Returns allocatable character array from table field name in values. If values is allocated, it will be deallocated first.

The function returns the following error codes:

  • E_ALLOC if array allocation failed.
  • E_EMPTY if the field of given name is null.
  • E_BOUNDS if a string length is greater than the array length.
  • E_TYPE if not a table or not a string element.

On error, values will be allocated but empty.

Arguments

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

Lua type.

character(len=*), intent(in) :: name

Table field name.

character(len=*), intent(inout), allocatable :: values(:)

Table field values.

logical, intent(in), optional :: unescape

Unescape strings.

Return Value integer

private function lua_field_int32(lua, name, value) result(rc)

Returns 4-byte integer from table field name in value.

The function returns the following error codes:

  • E_EMPTY if the field of given name is null.
  • E_TYPE if the field 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.

character(len=*), intent(in) :: name

Table field name.

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

Table field value.

Return Value integer

private function lua_field_int64(lua, name, value) result(rc)

Returns 8-byte integer from table field name in value.

The function returns the following error codes:

  • E_EMPTY if the field of given name is null.
  • E_TYPE if the field 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.

character(len=*), intent(in) :: name

Table field name.

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

Table field value.

Return Value integer

private function lua_field_logical(lua, name, value) result(rc)

Returns logical from table field name in value.

The function returns the following error codes:

  • E_EMPTY if the field of given name is null.
  • E_TYPE if the field 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.

character(len=*), intent(in) :: name

Table field name.

logical, intent(inout) :: value

Table field value.

Return Value integer

private function lua_field_real64(lua, name, value) result(rc)

Returns 8-byte real from table field name in value.

The function returns the following error codes:

  • E_EMPTY if the field of given name is null.
  • E_TYPE if the field 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.

character(len=*), intent(in) :: name

Table field name.

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

Table field value.

Return Value integer

private function lua_field_stack(lua, name) result(rc)

Pushes table field of given name on stack.

The function returns the following error codes:

  • E_EMPTY if the field of given name is null.

Arguments

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

Lua type.

character(len=*), intent(in) :: name

Field name.

Return Value integer

private function lua_field_string(lua, name, value, unescape) result(rc)

Returns character string from table field name 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 field of given name is null.
  • E_BOUNDS if the actual string length is greater than the length of the passed value argument.
  • E_TYPE if the field 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.

character(len=*), intent(in) :: name

Table field name.

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

Table field value.

logical, intent(in), optional :: unescape

Unescape the string.

Return Value integer