temporal_lua_for Function

private function temporal_lua_for(fun_ref, time, conf) result(res)

This function evaluate lua function and return its result

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: fun_ref

Lua reference to the function to evaluate.

type(tem_time_type), intent(in) :: time

timer object incl. the current time information

type(flu_State) :: conf

optional lua state

Return Value real(kind=rk)

return value


Source Code

  function temporal_lua_for(fun_ref, time, conf) result(res)
    ! --------------------------------------------------------------------------
    !> Lua reference to the function to evaluate.
    integer, intent(in) :: fun_ref
    !> timer object incl. the current time information
    type(tem_time_type), intent( in )  :: time
    !> optional lua state
    type(flu_State) :: conf
    !> return value
    real(kind=rk) :: res
    ! --------------------------------------------------------------------------
    ! local variables
    type(aot_fun_type) :: fun
    integer :: iError
    ! --------------------------------------------------------------------------

    call aot_fun_open( L=conf, fun=fun, ref=fun_ref )

    call aot_fun_put( L=conf, fun=fun, arg=time%sim )
    call aot_fun_do( L=conf, fun=fun, nresults=1 )
    call aot_top_get_val( L=conf, val=res, ErrCode=iError )

    call aot_fun_close( L=conf, fun=fun )

  end function temporal_lua_for