This subroutine takes a one dimensional array, and puts it as a table into the Lua context.
The returned thandle provides the index to access this newly created table.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(flu_State) | :: | L |
Handle to the Lua script. |
|||
integer, | intent(out) | :: | thandle |
Handle to access the newly created table. |
||
real(kind=single_k), | intent(in) | :: | val(:) |
Values to put into the new table. |
subroutine create_1Darray_real(L, thandle, val)
type(flu_State) :: L !! Handle to the Lua script.
!> Handle to access the newly created table.
integer, intent(out) :: thandle
!> Values to put into the new table.
real(kind=single_k), intent(in) :: val(:)
integer :: tab
integer :: nvals
integer :: i
nVals = size(val)
call flu_createtable(L, nVals, 0)
thandle = flu_gettop(L)
tab = thandle
do i=1,nVals
call flu_pushInteger(L, i)
call flu_pushNumber(L, val(i))
call flu_settable(L, tab)
end do
end subroutine create_1Darray_real