aot_fun_top Function

public function aot_fun_top(L) result(fun)

Return the stack of the top as a function.

If it actually is not a Lua function, the returned handle will be 0.


Type IntentOptional AttributesName
type(flu_state) :: L

Handle for the Lua script.

Return Value type(aot_fun_type)

Handle to the function on the top of the stack.


proc~~aot_fun_top~~CallsGraph proc~aot_fun_top aot_fun_top proc~flu_isfunction flu_isFunction proc~aot_fun_top->proc~flu_isfunction proc~flu_topointer flu_topointer proc~aot_fun_top->proc~flu_topointer proc~flu_gettop flu_gettop proc~aot_fun_top->proc~flu_gettop proc~flu_pushvalue flu_pushvalue proc~aot_fun_top->proc~flu_pushvalue interface~lua_type lua_type proc~flu_isfunction->interface~lua_type interface~lua_topointer lua_topointer proc~flu_topointer->interface~lua_topointer interface~lua_gettop lua_gettop proc~flu_gettop->interface~lua_gettop interface~lua_pushvalue lua_pushvalue proc~flu_pushvalue->interface~lua_pushvalue

Called by

proc~~aot_fun_top~~CalledByGraph proc~aot_fun_top aot_fun_top proc~aot_fun_table aot_fun_table proc~aot_fun_table->proc~aot_fun_top proc~aot_fun_ref aot_fun_ref proc~aot_fun_ref->proc~aot_fun_top interface~aot_fun_open aot_fun_open interface~aot_fun_open->proc~aot_fun_table interface~aot_fun_open->proc~aot_fun_ref proc~aot_path_open_fun aot_path_open_fun proc~aot_path_open_fun->interface~aot_fun_open interface~aot_path_open aot_path_open interface~aot_path_open->proc~aot_path_open_fun


Source Code

Source Code

  function aot_fun_top(L) result(fun)
    type(flu_state) :: L !! Handle for the Lua script.

    !> Handle to the function on the top of the stack.
    type(aot_fun_type) :: fun

    fun%handle = 0
    fun%arg_count = 0
    if (flu_isFunction(L, -1)) then
      ! Keep a handle to this function.
      fun%handle = flu_gettop(L)
      fun%id = flu_topointer(L, -1)
      ! Push a copy of the function right after it, the function will
      ! be popped from the stack upon execution. Thus, this copy is
      ! used to ensure the reference to the function is kept across
      ! several executions of the function.
      call flu_pushvalue(L, -1)
    end if
  end function aot_fun_top