Retrieve a quadruple precision real value from a table.
NOTE that Lua actually only provides double precision numbers, and this interface is merely a convenience for Fortran implementations with quadruple precision real numbers.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=quad_k), | intent(out) | :: | val | Value of the table entry if it exists. |
||
integer, | intent(out) | :: | ErrCode | Error code to indicate what kind of problem might have occured. |
||
type(flu_State) | :: | L | ||||
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. |
|
real(kind=quad_k), | intent(in), | optional | :: | default | Some default value, that should be used, if the variable is not set in the Lua script. |
subroutine get_table_quadruple(val, ErrCode, L, thandle, key, pos, &
& default)
type(flu_State) :: L !< Handle to the Lua script.
!> Handle to the table to look the value up in.
integer, intent(in), optional :: thandle
!> Value of the table entry if it exists.
real(kind=quad_k), intent(out) :: val
!> Error code to indicate what kind of problem might have occured.
integer, intent(out) :: ErrCode
!> 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
!> Some default value, that should be used, if the variable is not set in
!! the Lua script.
real(kind=quad_k), intent(in), optional :: default
logical :: valid_args
integer :: toptype
valid_args = .true.
if (present(thandle)) then
call aot_table_push(L=L, thandle=thandle, &
& key=key, pos=pos)
else
if (present(key)) then
toptype = flu_getglobal(L, key)
else
valid_args = .false.
end if
end if
if (valid_args) then
call aot_top_get_val(val, ErrCode, L, default)
else
ErrCode = ibSet(0, aoterr_NonExistent)
ErrCode = ibSet(ErrCode, aoterr_Fatal)
end if
end subroutine get_table_quadruple