aot_exists Function

public function aot_exists(L, thandle, key, pos) result(exists)

Returns wether a given entity exists in the Lua script L.

The entity is identified by a table handle for the containing table if it is not a global variable. A key or a position.

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L

Handle to the Lua script.

integer, intent(in), optional :: thandle

Handle to the table to look the value up in.

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

Name of the entry to look for.

Key and pos are both optional, however at least one of them has to be supplied. The key takes precedence over the pos if both are given.

integer, intent(in), optional :: pos

Position of the entry to look for in the table.

It allows the access to unnamed arrays in the Lua tables.

Return Value logical


Calls

proc~~aot_exists~~CallsGraph proc~aot_exists aot_exists proc~aot_table_push aot_table_push proc~aot_exists->proc~aot_table_push proc~flu_pop flu_pop proc~aot_exists->proc~flu_pop proc~aot_table_push->proc~flu_pop 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_getglobal flu_getglobal proc~aot_table_push->proc~flu_getglobal proc~flu_gettable flu_gettable proc~aot_table_push->proc~flu_gettable proc~flu_pushnil flu_pushnil proc~aot_table_push->proc~flu_pushnil proc~flu_type flu_type proc~aot_table_push->proc~flu_type interface~lua_settop lua_settop proc~flu_pop->interface~lua_settop 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 interface~lua_getglobal lua_getglobal proc~flu_getglobal->interface~lua_getglobal interface~lua_gettable lua_gettable proc~flu_gettable->interface~lua_gettable interface~lua_pushnil lua_pushnil proc~flu_pushnil->interface~lua_pushnil interface~lua_type lua_type proc~flu_type->interface~lua_type interface~lua_pushinteger lua_pushinteger proc~flu_pushint->interface~lua_pushinteger proc~flu_pushlong->interface~lua_pushinteger

Source Code

  function aot_exists(L, thandle, key, pos) result(exists)
    type(flu_State) :: L !! Handle to the Lua script.

    !> Handle to the table to look the value up in.
    integer, intent(in), optional :: thandle

    !> Name of the entry to look for.
    !!
    !! Key and pos are both optional, however at least one of them has to be
    !! supplied.
    !! The key takes precedence over the pos if both are given.
    character(len=*), intent(in), optional :: key

    !> Position of the entry to look for in the table.
    !!
    !! It allows the access to unnamed arrays in the Lua tables.
    integer, intent(in), optional :: pos

    logical :: exists

    logical :: valid_args
    integer :: toptype

    exists = .false.

    valid_args = .false.
    toptype = FLU_TNONE
    call aot_table_push( L       = L,       &
      &                  thandle = thandle, &
      &                  key     = key,     &
      &                  pos     = pos,     &
      &                  toptype = toptype  )
    exists = (toptype /= FLU_TNONE .and. toptype /= FLU_TNIL)

    call flu_pop(L)

  end function aot_exists