aot_type_of Function

public function aot_type_of(L, thandle, key, pos) result(luatype)

Get the Lua object in table thandle under the given key or pos on the top of the stack and return the Lua type of the gotten entry.

This might be used to get a Lua entry to the top of the stack without knowing its type beforehand, and then deciding what to load, based on the type. Lua types are encoded as integer values and available in the flu_binding module.

  • FLU_TNONE : not existing
  • FLU_TNIL : not available
  • FLU_TBOOLEAN : logical value
  • FLU_TNUMBER : a number
  • FLU_TSTRING : a string
  • FLU_TTABLE : a table
  • FLU_TFUNCTION: a function

If none of key, pos or thandle are provided, the type of the current top of the stack will be returned. Just passing pos without a thandle is invalid and always returns FLU_TNONE.

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L

Handle to the Lua script.

integer, intent(in), optional :: thandle

Handle of the table to get the value from

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

Key of the value to find the type for.

integer, intent(in), optional :: pos

Position of the value to find the type for.

Return Value integer

Type of the Lua object found in L, thandle, key and pos


Calls

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

Called by

proc~~aot_type_of~~CalledByGraph proc~aot_type_of aot_type_of proc~get_table_double_v get_table_double_v proc~get_table_double_v->proc~aot_type_of proc~get_table_double_vvect get_table_double_vvect proc~get_table_double_vvect->proc~aot_type_of proc~get_table_integer_v get_table_integer_v proc~get_table_integer_v->proc~aot_type_of proc~get_table_integer_vvect get_table_integer_vvect proc~get_table_integer_vvect->proc~aot_type_of proc~get_table_logical_v get_table_logical_v proc~get_table_logical_v->proc~aot_type_of proc~get_table_logical_vvect get_table_logical_vvect proc~get_table_logical_vvect->proc~aot_type_of proc~get_table_long_v get_table_long_v proc~get_table_long_v->proc~aot_type_of proc~get_table_long_vvect get_table_long_vvect proc~get_table_long_vvect->proc~aot_type_of proc~get_table_real_v get_table_real_v proc~get_table_real_v->proc~aot_type_of proc~get_table_real_vvect get_table_real_vvect proc~get_table_real_vvect->proc~aot_type_of proc~get_table_string_v get_table_string_v proc~get_table_string_v->proc~aot_type_of proc~get_table_string_vvect get_table_string_vvect proc~get_table_string_vvect->proc~aot_type_of interface~aot_get_val~5 aot_get_val interface~aot_get_val~5->proc~get_table_double_vvect interface~aot_get_val~5->proc~get_table_integer_vvect interface~aot_get_val~5->proc~get_table_logical_vvect interface~aot_get_val~5->proc~get_table_long_vvect interface~aot_get_val~5->proc~get_table_real_vvect interface~aot_get_val~5->proc~get_table_string_vvect interface~aot_get_val~6 aot_get_val interface~aot_get_val~6->proc~get_table_double_v interface~aot_get_val~6->proc~get_table_integer_v interface~aot_get_val~6->proc~get_table_logical_v interface~aot_get_val~6->proc~get_table_long_v interface~aot_get_val~6->proc~get_table_real_v interface~aot_get_val~6->proc~get_table_string_v interface~aot_table_get_val~5 aot_table_get_val interface~aot_table_get_val~5->proc~get_table_double_vvect interface~aot_table_get_val~5->proc~get_table_integer_vvect interface~aot_table_get_val~5->proc~get_table_logical_vvect interface~aot_table_get_val~5->proc~get_table_long_vvect interface~aot_table_get_val~5->proc~get_table_real_vvect interface~aot_table_get_val~5->proc~get_table_string_vvect interface~aot_table_get_val~6 aot_table_get_val interface~aot_table_get_val~6->proc~get_table_double_v interface~aot_table_get_val~6->proc~get_table_integer_v interface~aot_table_get_val~6->proc~get_table_logical_v interface~aot_table_get_val~6->proc~get_table_long_v interface~aot_table_get_val~6->proc~get_table_real_v interface~aot_table_get_val~6->proc~get_table_string_v

Source Code

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

    !> Handle of the table to get the value from
    integer, intent(in), optional :: thandle

    !> Key of the value to find the type for.
    character(len=*), intent(in), optional :: key

    !> Position of the value to find the type for.
    integer, intent(in), optional :: pos

    !> Type of the Lua object found in L, thandle, key and pos
    integer :: luatype

    luatype = FLU_TNONE

    if (present(thandle)) then
      call aot_table_push( L       = L,       &
        &                  thandle = thandle, &
        &                  key     = key,     &
        &                  pos     = pos,     &
        &                  toptype = luatype  )
    else
      if (present(key)) then
        luatype = flu_getglobal(L, key)
      else if (.not. present(pos)) then
        luatype = flu_type(L, -1)
      end if
    end if

  end function aot_type_of