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 | ||||
integer, | intent(out) | :: | thandle |
Handle to access the newly created table. |
||
real(kind=quad_k), | intent(in) | :: | val(:) |
Values to put into the new table. |
subroutine create_1Darray_quadruple(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=quad_k), intent(in) :: val(:) integer :: tab integer :: nvals integer :: i real(kind=double_k), allocatable :: locval(:) nVals = size(val) allocate(locVal(nVals)) locVal(:) = real(val, kind=double_k) 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, locval(i)) call flu_settable(L, tab) end do deallocate(locval) end subroutine create_1Darray_quadruple