dm_lua Module

Lua abstraction layer that provides procedures for reading from and writing to the Lua stack.

The following example creates a new Lua state, then pushes an observation to and pulls it from the stack:

integer              :: rc
type(lua_state_type) :: lua
type(observ_type)    :: observ1, observ2

rc = dm_lua_init(lua)          ! Initialise Lua interpreter.
call dm_lua_from(lua, observ1) ! Push observation onto stack.
rc = dm_lua_to(lua, observ2)   ! Read observation back from stack.
call dm_lua_destroy(lua)       ! Destroy Lua interpreter.

Uses

  • module~~dm_lua~~UsesGraph module~dm_lua dm_lua iso_c_binding iso_c_binding module~dm_lua->iso_c_binding lua lua module~dm_lua->lua module~dm_error dm_error module~dm_lua->module~dm_error module~dm_file dm_file module~dm_lua->module~dm_file module~dm_kind dm_kind module~dm_lua->module~dm_kind module~dm_string dm_string module~dm_lua->module~dm_string module~dm_util dm_util module~dm_lua->module~dm_util module~dm_error->module~dm_kind module~dm_ascii dm_ascii module~dm_error->module~dm_ascii module~dm_file->module~dm_error module~dm_file->module~dm_kind iso_fortran_env iso_fortran_env module~dm_kind->iso_fortran_env module~dm_string->module~dm_error module~dm_string->module~dm_kind module~dm_util->module~dm_error module~dm_util->module~dm_kind

Used by

  • module~~dm_lua~~UsedByGraph module~dm_lua dm_lua module~dm_config dm_config module~dm_config->module~dm_lua module~dm_lua_api dm_lua_api module~dm_lua_api->module~dm_lua module~dm_lua_geocom dm_lua_geocom module~dm_lua_geocom->module~dm_lua module~dmpack dmpack module~dmpack->module~dm_lua module~dmpack->module~dm_config module~dmpack->module~dm_lua_api module~dmpack->module~dm_lua_geocom proc~luaopen_libdmpack luaopen_libdmpack proc~luaopen_libdmpack->module~dm_lua proc~luaopen_libdmpack->module~dm_lua_api proc~luaopen_libdmpack->module~dm_lua_geocom proc~dm_config_open dm_config_open proc~dm_config_open->module~dm_lua_api proc~dm_config_open->module~dm_lua_geocom

Interfaces

public interface dm_lua_field

Pushes table element on stack and optionally returns value.

  • 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

public interface dm_lua_get

Pushes table index on stack and optionally returns value.

  • 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

public interface dm_lua_from

Converts derived types to Lua table on stack.

  • private subroutine lua_from_observ(lua, observ)

    Pushes observation on Lua stack.

    Arguments

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

    Lua type.

    type(observ_type), intent(inout) :: observ

    Observation type.

  • private subroutine lua_from_request(lua, request)

    Pushes request on Lua stack.

    Arguments

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

    Lua type.

    type(request_type), intent(inout) :: request

    Request type.

public interface dm_lua_read

Pushes global variable on stack and optionally returns value.

  • private function lua_read_array_int32(lua, name, values) result(rc)

    Returns the values of global variable as 4-byte integers.

    The function returns the following error codes:

    • E_ALLOC if array allocation failed.
    • E_TYPE if variable is not an integer table.

    Arguments

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

    Lua type.

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

    Variable name.

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

    Variable values.

    Return Value integer

  • private function lua_read_array_int64(lua, name, values) result(rc)

    Returns the values of global variable as 8-byte integers.

    The function returns the following error codes:

    • E_ALLOC if array allocation failed.
    • E_TYPE if variable is not an integer table.

    Arguments

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

    Lua type.

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

    Variable name.

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

    Variable values.

    Return Value integer

  • private function lua_read_int32(lua, name, value) result(rc)

    Returns the value of global variable as 4-byte integer. The function returns E_TYPE if the variable is not of type integer.

    Arguments

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

    Lua type.

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

    Variable name.

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

    Variable value.

    Return Value integer

  • private function lua_read_int64(lua, name, value) result(rc)

    Returns the value of global variable as 8-byte integer. The function returns E_TYPE if the variable is not of type integer.

    Arguments

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

    Lua type.

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

    Variable name.

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

    Variable value.

    Return Value integer

  • private function lua_read_logical(lua, name, value) result(rc)

    Returns the value of global variable as logical. The function returns E_TYPE if the variable is not of type boolean.

    Arguments

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

    Lua type.

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

    Variable name.

    logical, intent(inout) :: value

    Variable value.

    Return Value integer

  • private function lua_read_real64(lua, name, value) result(rc)

    Returns the value of global variable as 8-byte real. The function returns E_TYPE if the variable is not of type number.

    Arguments

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

    Lua type.

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

    Variable name.

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

    Variable value.

    Return Value integer

  • private function lua_read_stack(lua, name) result(rc)

    Pushes global variable on stack. Returns E_EMPTY if the variable does not exist.

    Arguments

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

    Lua type.

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

    Variable name.

    Return Value integer

  • private function lua_read_string(lua, name, value) result(rc)

    Returns the value of global variable as allocatable string. The function returns E_TYPE if the variable is not of type string.

    Arguments

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

    Lua type.

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

    Variable name.

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

    Variable value.

    Return Value integer

public interface dm_lua_set

  • private function lua_set_int32(lua, name, value) result(rc)

    Sets 4-byte integer variable of given name.

    Arguments

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

    Lua type.

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

    Name of variable

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

    Value of variable.

    Return Value integer

public interface dm_lua_to

Converts Lua table to Fortran derived type.

  • private function lua_to_job(lua, job) result(rc)

    Reads Lua table into Fortran job type. The table has to be on top of the stack and will be removed once finished.

    Arguments

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

    Lua type.

    type(job_type), intent(out) :: job

    Job type.

    Return Value integer

  • private function lua_to_job_list(lua, job_list) result(rc)

    Reads Lua table into Fortran job list. The table has to be on top of the stack and will be removed once finished.

    Arguments

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

    Lua type.

    type(job_list_type), intent(out) :: job_list

    Job list type.

    Return Value integer

  • private function lua_to_jobs(lua, jobs) result(rc)

    Reads Lua table into Fortran jobs type array. The table has to be on top of the stack and will be removed once finished.

    The functions returns the following error codes:

    • E_ALLOC if the array allocation failed.
    • E_EMPTY if the table is empty.
    • E_TYPE if the stack element is not a table.

    Arguments

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

    Lua type.

    type(job_type), intent(out), allocatable :: jobs(:)

    Job type array.

    Return Value integer

  • private function lua_to_observ(lua, observ) result(rc)

    Reads Lua table into Fortran observation type. The table has to be on top of the stack and will be removed once finished.

    Arguments

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

    Lua type.

    type(observ_type), intent(out) :: observ

    Observation type.

    Return Value integer

  • private function lua_to_observs(lua, observs) result(rc)

    Reads Lua table into Fortran observation type array. The table has to be on top of the stack and will be removed once finished.

    Arguments

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

    Lua type.

    type(observ_type), intent(out), allocatable :: observs(:)

    Observation type array.

    Return Value integer

  • private function lua_to_report(lua, report) result(rc)

    Reads Lua table into Fortran report type. The table has to be on top of the stack and will be removed once finished.

    Arguments

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

    Lua type.

    type(report_type), intent(out) :: report

    Report type.

    Return Value integer

  • private function lua_to_request(lua, request) result(rc)

    Reads Lua table into Fortran request type. The table has to be on top of the stack and will be removed once finished.

    Arguments

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

    Lua type.

    type(request_type), intent(out) :: request

    Request type.

    Return Value integer


Abstract Interfaces

abstract interface

  • public function dm_lua_callback(ptr) bind(c)

    C-interoperable Lua callback function.

    Arguments

    Type IntentOptional Attributes Name
    type(c_ptr), intent(in), value :: ptr

    Lua state pointer.

    Return Value integer(kind=c_int)

    Return value.


Derived Types

type, public ::  lua_state_type

Lua state type that stores the Lua pointer.

Components

Type Visibility Attributes Name Initial
type(c_ptr), public :: ctx = c_null_ptr

C pointer to Lua interpreter.


Functions

public function dm_lua_call(lua, nargs, nresults) result(rc)

Calls Lua function on top of stack.

Arguments

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

Lua type.

integer, intent(in) :: nargs

Number of arguments.

integer, intent(in) :: nresults

Number of results.

Return Value integer

public function dm_lua_error(lua_error) result(rc)

Converts Lua error code to DMPACK error code.

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: lua_error

Lua error code.

Return Value integer

public function dm_lua_error_string(lua) result(str)

Returns last error message as allocatable character string or an empty string if no message is available.

Arguments

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

Lua type.

Return Value character(len=:), allocatable

Last error message.

public function dm_lua_escape(str) result(res)

Escapes passed character string by replacing each occurance of \ with \\.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str

String to escape.

Return Value character(len=:), allocatable

Escaped string.

public function dm_lua_eval(lua, command) result(rc)

Executes Lua command passed in character string command.

Arguments

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

Lua type.

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

Lua command to evaluate.

Return Value integer

public function dm_lua_exec(lua, file_path) result(rc)

Executes Lua script.

Arguments

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

Lua type.

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

Path to Lua script file.

Return Value integer

public function dm_lua_init(lua, libs) result(rc)

Initialises Lua interpreter and opens libraries, unless libs is .false.. Returns E_EXIST if the Lua pointer is already associated, and E_LUA if one of the Lua calls failed.

Arguments

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

Lua type.

logical, intent(in), optional :: libs

Open Lua libraries.

Return Value integer

public function dm_lua_is_function(lua) result(is_function)

Returns .true. if element on top of stack is of type function.

Arguments

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

Lua type.

Return Value logical

public function dm_lua_is_nil(lua) result(is_nil)

Returns .true. if element on top of stack is nil.

Arguments

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

Lua type.

Return Value logical

public function dm_lua_is_opened(lua) result(is_opened)

Returns .true. if pointer to Lua interpreter is associated.

Arguments

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

Lua type.

Return Value logical

public function dm_lua_is_table(lua) result(is_table)

Returns .true. if element on top of stack is of type table.

Arguments

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

Lua type.

Return Value logical

public function dm_lua_open(lua, file_path, eval) result(rc)

Opens Lua script and executes it by default. The function returns the following error codes:

Read more…

Arguments

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

Lua type.

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

Path to Lua script.

logical, intent(in), optional :: eval

Evaluate script once.

Return Value integer

public function dm_lua_table(lua, name, n) result(rc)

Loads global table of given name. The function returns the following error codes:

Read more…

Arguments

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

Lua type.

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

Name of table.

integer, intent(out), optional :: n

Number of elements in table.

Return Value integer

public function dm_lua_table_size(lua) result(n)

Returns size of table on stack. Returns -1 on error.

Arguments

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

Lua type.

Return Value integer

public function dm_lua_to_int32(lua, idx) result(value)

Returns 4-byte integer from Lua stack at position idx.

Arguments

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

Lua type.

integer, intent(in) :: idx

Stack index.

Return Value integer(kind=i4)

public function dm_lua_to_int64(lua, idx) result(value)

Returns 8-byte integer from Lua stack at position idx.

Arguments

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

Lua type.

integer, intent(in) :: idx

Stack index.

Return Value integer(kind=i8)

public function dm_lua_to_logical(lua, idx) result(value)

Returns 8-byte integer from Lua stack at position idx.

Arguments

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

Lua type.

integer, intent(in) :: idx

Stack index.

Return Value logical

public function dm_lua_to_real32(lua, idx) result(value)

Returns 4-byte real from Lua stack at position idx.

Arguments

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

Lua type.

integer, intent(in) :: idx

Stack index.

Return Value real(kind=r4)

public function dm_lua_to_real64(lua, idx) result(value)

Returns 8-byte real from Lua stack at position idx.

Arguments

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

Lua type.

integer, intent(in) :: idx

Stack index.

Return Value real(kind=r8)

public function dm_lua_to_string(lua, idx) result(value)

Returns allocatable character string from Lua stack at position idx.

Arguments

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

Lua type.

integer, intent(in) :: idx

Stack index.

Return Value character(len=:), allocatable

String value.

public function dm_lua_unescape(str) result(res)

Unescapes passed character string by replacing each occurance of \\ with \.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str

String to escape.

Return Value character(len=:), allocatable

Unescaped string.

public function dm_lua_version(name) result(version)

Returns Lua version as allocatable string of the form 5.4 or liblua/5.4 if argument name is .true..

Arguments

Type IntentOptional Attributes Name
logical, intent(in), optional :: name

Add prefix liblua/.

Return Value character(len=:), allocatable


Subroutines

public subroutine dm_lua_destroy(lua)

Closes Lua.

Arguments

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

Lua type.

public subroutine dm_lua_dump_stack(lua, unit)

Dumps stack to standard output or file unit.

Arguments

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

Lua type.

integer, intent(in), optional :: unit

File unit.

public subroutine dm_lua_pop(lua, n)

Pops element on stack.

Arguments

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

Lua type.

integer, intent(in), optional :: n

Stack position.

public subroutine dm_lua_register(lua, name, proc)

Registers a new Lua command.

Arguments

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

Lua type.

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

Lua procedure name.

procedure(dm_lua_callback) :: proc

C-interoperable subroutine to call.

public subroutine dm_lua_version_number(lua, major, minor)

Returns Lua version number.

Arguments

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

Lua type.

integer, intent(out) :: major

Major version number.

integer, intent(out) :: minor

Minor version number.