set_table_real Subroutine

private subroutine set_table_real(val, L, thandle, key, pos)

Put a single precision real value into a table.

Arguments

Type IntentOptional AttributesName
real(kind=single_k), intent(in) :: val

Value of the table entry if it exists.

type(flu_State) :: L

Handle to the Lua script.

integer, intent(in) :: 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.


Calls

proc~~set_table_real~~CallsGraph proc~set_table_real set_table_real proc~flu_setfield flu_setfield proc~set_table_real->proc~flu_setfield proc~flu_settable flu_settable proc~set_table_real->proc~flu_settable interface~flu_pushnumber flu_pushnumber proc~set_table_real->interface~flu_pushnumber interface~flu_pushinteger flu_pushinteger proc~set_table_real->interface~flu_pushinteger interface~lua_setfield lua_setfield proc~flu_setfield->interface~lua_setfield interface~lua_settable lua_settable proc~flu_settable->interface~lua_settable proc~flu_pushdouble flu_pushdouble interface~flu_pushnumber->proc~flu_pushdouble proc~flu_pushreal flu_pushreal interface~flu_pushnumber->proc~flu_pushreal proc~flu_pushint flu_pushint interface~flu_pushinteger->proc~flu_pushint proc~flu_pushlong flu_pushlong interface~flu_pushinteger->proc~flu_pushlong interface~lua_pushnumber lua_pushnumber proc~flu_pushdouble->interface~lua_pushnumber interface~lua_pushinteger lua_pushinteger proc~flu_pushint->interface~lua_pushinteger proc~flu_pushreal->interface~lua_pushnumber proc~flu_pushlong->interface~lua_pushinteger

Called by

proc~~set_table_real~~CalledByGraph proc~set_table_real set_table_real interface~aot_table_set_val aot_table_set_val interface~aot_table_set_val->proc~set_table_real proc~aot_require_buffer aot_require_buffer proc~aot_require_buffer->interface~aot_table_set_val

Contents

Source Code


Source Code

  subroutine set_table_real(val, L, thandle, key, pos)
    type(flu_State) :: L !! Handle to the Lua script.

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

    !> Value of the table entry if it exists.
    real(kind=single_k), intent(in) :: val

    !> 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

    if (thandle > 0) then
      if (present(key)) then
        ! If there is a key, use that.
        ! First put the value on the top of the stack
        call flu_pushNumber(L, val)
        ! Now put it into the table
        call flu_setField(L, thandle, trim(key))
      else
        ! No key given, try to put the value by position
        if (present(pos)) then
          ! First put the index, where to write the value into the table, on the
          ! stack.
          call flu_pushInteger(L, pos)
          ! Now put the actual value on the top of the stack.
          call flu_pushNumber(L, val)
          ! Get the two entries from the stack into the table.
          call flu_setTable(L, thandle)
        end if
      end if
    end if

  end subroutine set_table_real