aot_table_open Subroutine

public subroutine aot_table_open(L, parent, thandle, key, pos)

This subroutine tries to open a table, and returns a handle for it.

If parent is present, the table is tried to open within that table. Return its position in the stack as a handle for this table. If it does not exist or the table entry is not a table itself, the handle will be set to 0. The table can be looked up either by position or name.

If a key is present but no parent, a global table is opened. If neither key nor parent is present, a new table is created. Only passing pos, without a thandle is erroneous and always results in a thandle = 0.

After the table is opened, the returned handle can be used to access its components.

Arguments

Type IntentOptional AttributesName
type(flu_state) :: L

Handle for the Lua script.

integer, intent(in), optional :: parent

Handle of the table containing the requested table.

integer, intent(out) :: thandle

A handle for the table to access it, 0 if no table available.

character(len=*), intent(in), optional :: key

Name of the entry in the parent table to access.

The key takes precedence over the position, if both are provided. In this case the positional address is only tried, if the access to the key failed.

integer, intent(in), optional :: pos

Position of the entry in the parent table to access.


Calls

proc~~aot_table_open~~CallsGraph proc~aot_table_open aot_table_open proc~flu_gettop flu_gettop proc~aot_table_open->proc~flu_gettop proc~aot_table_top aot_table_top proc~aot_table_open->proc~aot_table_top proc~flu_createtable flu_createtable proc~aot_table_open->proc~flu_createtable proc~aot_table_push aot_table_push proc~aot_table_open->proc~aot_table_push proc~flu_getglobal flu_getglobal proc~aot_table_open->proc~flu_getglobal interface~lua_gettop lua_gettop proc~flu_gettop->interface~lua_gettop proc~aot_table_top->proc~flu_gettop proc~flu_istable flu_isTable proc~aot_table_top->proc~flu_istable proc~flu_pop flu_pop proc~aot_table_top->proc~flu_pop interface~lua_createtable lua_createtable proc~flu_createtable->interface~lua_createtable proc~aot_table_push->proc~flu_getglobal proc~flu_pushnil flu_pushnil proc~aot_table_push->proc~flu_pushnil proc~flu_gettable flu_gettable proc~aot_table_push->proc~flu_gettable interface~flu_pushinteger flu_pushinteger proc~aot_table_push->interface~flu_pushinteger proc~flu_getfield flu_getfield proc~aot_table_push->proc~flu_getfield proc~flu_type flu_type proc~aot_table_push->proc~flu_type proc~aot_table_push->proc~flu_pop interface~lua_getglobal lua_getglobal proc~flu_getglobal->interface~lua_getglobal interface~lua_pushnil lua_pushnil proc~flu_pushnil->interface~lua_pushnil interface~lua_gettable lua_gettable proc~flu_gettable->interface~lua_gettable interface~lua_type lua_type proc~flu_istable->interface~lua_type proc~flu_pushint flu_pushint interface~flu_pushinteger->proc~flu_pushint proc~flu_pushlong flu_pushlong interface~flu_pushinteger->proc~flu_pushlong interface~lua_getfield lua_getfield proc~flu_getfield->interface~lua_getfield proc~flu_type->interface~lua_type interface~lua_settop lua_settop proc~flu_pop->interface~lua_settop interface~lua_pushinteger lua_pushinteger proc~flu_pushint->interface~lua_pushinteger proc~flu_pushlong->interface~lua_pushinteger

Called by

proc~~aot_table_open~~CalledByGraph proc~aot_table_open aot_table_open proc~aot_path_open_table aot_path_open_table proc~aot_path_open_table->proc~aot_table_open proc~aot_require_buffer aot_require_buffer proc~aot_require_buffer->proc~aot_table_open proc~aot_path_open_fun aot_path_open_fun proc~aot_path_open_fun->proc~aot_path_open_table interface~aot_path_open aot_path_open interface~aot_path_open->proc~aot_path_open_table interface~aot_path_open->proc~aot_path_open_fun

Contents

Source Code


Source Code

  subroutine aot_table_open(L, parent, thandle, key, pos)
    type(flu_state) :: L !! Handle for the Lua script.

    !> Handle of the table containing the requested table.
    integer, intent(in), optional :: parent

    !> A handle for the table to access it, 0 if no table available.
    integer, intent(out) :: thandle

    !> Name of the entry in the parent table to access.
    !!
    !! The key takes precedence over the position, if both are provided.
    !! In this case the positional address is only tried, if the access to the
    !! key failed.
    character(len=*), intent(in), optional :: key

    !> Position of the entry in the parent table to access.
    integer, intent(in), optional :: pos

    integer :: luatype

    thandle = 0

    if (present(parent)) then
      call aot_table_push(L, parent, key, pos)
      thandle = aot_table_top(L)
    else
      if (present(key)) then
        luatype = flu_getglobal(L, key)
        thandle = aot_table_top(L)
      else if (.not. present(pos)) then
        call flu_createtable(L, 0, 0)
        thandle = flu_gettop(L)
      end if
    end if

  end subroutine aot_table_open