flu_binding Module

This module provides the Fortran Lua interface.

It defines a flu_state which encapsulates the Lua state and is used to reference a Lua script. The main content are then the wrapper implementations which ease the usage of the Lua functions declared in the lua_fif module.

Naming follows the Lua API, but replaces the lua_ prefix by flu_.

Note

Documentation of the actual C functions can be found by replacing the flu_ prefix here by lua_ and refering to the Lua API documentation.


Uses

  • module~~flu_binding~~UsesGraph module~flu_binding flu_binding iso_c_binding iso_c_binding module~flu_binding->iso_c_binding module~dump_lua_fif_module dump_lua_fif_module module~flu_binding->module~dump_lua_fif_module module~flu_kinds_module flu_kinds_module module~flu_binding->module~flu_kinds_module module~lua_fif lua_fif module~flu_binding->module~lua_fif module~lua_parameters lua_parameters module~flu_binding->module~lua_parameters module~dump_lua_fif_module->iso_c_binding module~lua_fif->iso_c_binding module~lua_fif->module~lua_parameters module~lua_parameters->iso_c_binding

Used by

  • module~~flu_binding~~UsedByGraph module~flu_binding flu_binding module~aot_err_module aot_err_module module~aot_err_module->module~flu_binding module~aot_extdouble_fun_module aot_extdouble_fun_module module~aot_extdouble_fun_module->module~flu_binding module~aot_extdouble_top_module aot_extdouble_top_module module~aot_extdouble_fun_module->module~aot_extdouble_top_module module~aot_table_module aot_table_module module~aot_extdouble_fun_module->module~aot_table_module module~aot_extdouble_table_module aot_extdouble_table_module module~aot_extdouble_table_module->module~flu_binding module~aot_extdouble_table_module->module~aot_err_module module~aot_extdouble_table_module->module~aot_extdouble_top_module module~aot_table_ops_module aot_table_ops_module module~aot_extdouble_table_module->module~aot_table_ops_module module~aot_top_module aot_top_module module~aot_extdouble_table_module->module~aot_top_module module~aot_extdouble_top_module->module~flu_binding module~aot_extdouble_top_module->module~aot_err_module module~aot_extdouble_vector_module aot_extdouble_vector_module module~aot_extdouble_vector_module->module~flu_binding module~aot_extdouble_vector_module->module~aot_extdouble_top_module module~aot_extdouble_vector_module->module~aot_table_ops_module module~aot_extdouble_vector_module->module~aot_top_module module~aot_fun_module aot_fun_module module~aot_fun_module->module~flu_binding module~aot_fun_module->module~aot_extdouble_fun_module module~aot_quadruple_fun_module aot_quadruple_fun_module module~aot_fun_module->module~aot_quadruple_fun_module module~aot_references_module aot_references_module module~aot_fun_module->module~aot_references_module module~aot_fun_module->module~aot_table_module module~aot_fun_module->module~aot_top_module module~aot_path_module aot_path_module module~aot_path_module->module~flu_binding module~aot_path_module->module~aot_fun_module module~aot_path_module->module~aot_table_module module~aotus_module aotus_module module~aot_path_module->module~aotus_module module~aot_quadruple_fun_module->module~flu_binding module~aot_quadruple_top_module aot_quadruple_top_module module~aot_quadruple_fun_module->module~aot_quadruple_top_module module~aot_quadruple_fun_module->module~aot_table_module module~aot_quadruple_table_module aot_quadruple_table_module module~aot_quadruple_table_module->module~flu_binding module~aot_quadruple_table_module->module~aot_err_module module~aot_quadruple_table_module->module~aot_quadruple_top_module module~aot_quadruple_table_module->module~aot_table_ops_module module~aot_quadruple_table_module->module~aot_top_module module~aot_quadruple_top_module->module~flu_binding module~aot_quadruple_top_module->module~aot_err_module module~aot_quadruple_vector_module aot_quadruple_vector_module module~aot_quadruple_vector_module->module~flu_binding module~aot_quadruple_vector_module->module~aot_quadruple_top_module module~aot_quadruple_vector_module->module~aot_table_ops_module module~aot_quadruple_vector_module->module~aot_top_module module~aot_references_module->module~flu_binding module~aot_references_module->module~aot_table_ops_module module~aot_table_module->module~flu_binding module~aot_table_module->module~aot_err_module module~aot_table_module->module~aot_extdouble_table_module module~aot_table_module->module~aot_quadruple_table_module module~aot_table_module->module~aot_table_ops_module module~aot_table_module->module~aot_top_module module~aot_table_ops_module->module~flu_binding module~aot_table_ops_module->module~aot_top_module module~aot_top_module->module~flu_binding module~aot_top_module->module~aot_err_module module~aot_top_module->module~aot_extdouble_top_module module~aot_top_module->module~aot_quadruple_top_module module~aot_vector_module aot_vector_module module~aot_vector_module->module~flu_binding module~aot_vector_module->module~aot_extdouble_vector_module module~aot_vector_module->module~aot_quadruple_vector_module module~aot_vector_module->module~aot_table_ops_module module~aot_vector_module->module~aot_top_module module~aotus_module->module~flu_binding module~aotus_module->module~aot_table_module module~aotus_module->module~aot_top_module module~aotus_module->module~aot_vector_module program~test test program~test->module~flu_binding module~aot_extdouble_out_module aot_extdouble_out_module module~aot_extdouble_out_module->module~aot_extdouble_top_module module~aot_quadruple_out_module aot_quadruple_out_module module~aot_quadruple_out_module->module~aot_quadruple_top_module module~aot_out_module aot_out_module module~aot_out_module->module~aot_extdouble_out_module module~aot_out_module->module~aot_quadruple_out_module

Variables

Type Visibility Attributes Name Initial
integer, public, parameter :: FLU_TNONE = int(LUA_TNONE)
integer, public, parameter :: FLU_TNIL = int(LUA_TNIL)
integer, public, parameter :: FLU_TBOOLEAN = int(LUA_TBOOLEAN)
integer, public, parameter :: FLU_TLIGHTUSERDATA = int(LUA_TLIGHTUSERDATA)
integer, public, parameter :: FLU_TNUMBER = int(LUA_TNUMBER)
integer, public, parameter :: FLU_TSTRING = int(LUA_TSTRING)
integer, public, parameter :: FLU_TTABLE = int(LUA_TTABLE)
integer, public, parameter :: FLU_TFUNCTION = int(LUA_TFUNCTION)
integer, public, parameter :: FLU_TUSERDATA = int(LUA_TUSERDATA)
integer, public, parameter :: FLU_TTHREAD = int(LUA_TTHREAD)

Interfaces

public interface flu_pushnumber

  • private subroutine flu_pushreal(L, n)

    Arguments

    Type IntentOptional Attributes Name
    type(flu_State) :: L
    real :: n
  • private subroutine flu_pushdouble(L, n)

    Arguments

    Type IntentOptional Attributes Name
    type(flu_State) :: L
    real(kind=c_double) :: n

public interface flu_pushinteger

  • private subroutine flu_pushint(L, n)

    Arguments

    Type IntentOptional Attributes Name
    type(flu_State) :: L
    integer(kind=int_k) :: n
  • private subroutine flu_pushlong(L, n)

    Arguments

    Type IntentOptional Attributes Name
    type(flu_State) :: L
    integer(kind=long_k) :: n

public interface flu_dump

  • private subroutine flu_dump_toBuf(L, buf, length, iError)

    Dump to a buffer and return the pointer to the resulting string.

    Arguments

    Type IntentOptional Attributes Name
    type(flu_State) :: L
    type(cbuf_type), intent(out) :: buf
    integer :: length
    integer :: iError

interface

  • private subroutine c_free(ptr) bind(c, name="free")

    Arguments

    Type IntentOptional Attributes Name
    type(c_ptr), value :: ptr

Abstract Interfaces

abstract interface

Interoperable interface required for a function that is callable from Lua.

  • public function lua_Function(s) result(val) bind(c)

    Arguments

    Type IntentOptional Attributes Name
    type(c_ptr), value :: s

    Return Value integer(kind=c_int)


Derived Types

type, public ::  flu_State

Encapsulation of the Lua state.

Read more…

Components

Type Visibility Attributes Name Initial
type(c_ptr), private :: state = c_null_ptr
logical, private :: opened_libs = .false.

type, public ::  cbuf_type

Components

Type Visibility Attributes Name Initial
type(c_ptr), public :: ptr = c_null_ptr
character(len=1), public, pointer :: buffer(:) => NULL()

Functions

public function flu_getfield(L, index, k) result(luatype)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index
character(len=*) :: k

Return Value integer

public function flu_getglobal(L, k) result(luatype)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
character(len=*) :: k

Return Value integer

public function flu_gettable(L, index) result(luatype)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value integer

public function flu_gettop(L) result(stacktop)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L

Return Value integer

public function flu_isBoolean(L, index) result(is_boolean)

Only defined as a Macro, using lua_type:

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_isFunction(L, index) result(is_function)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_isnumber(L, index) result(is_number)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_isString(L, index) result(is_string)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_isTable(L, index) result(is_Table)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_isNoneOrNil(L, index) result(is_NoneOrNil)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_isNil(L, index) result(is_Nil)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_isNone(L, index) result(is_None)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_islightuserdata(L, index) result(is_lightuserdata)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_next(L, index) result(exists)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer, intent(in) :: index

Return Value logical

public function flu_pcall(L, nargs, nresults, errfunc) result(errcode)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: nargs
integer :: nresults
integer :: errfunc

Return Value integer

public function flu_rawgeti(L, index, n) result(luatype)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer, intent(in) :: index
integer, intent(in) :: n

Return Value integer

public function flu_tolstring(L, index, len) result(string)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index
integer :: len

Return Value character(len=1), pointer, dimension(:)

public function flu_todouble(L, index) result(number)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value real(kind=c_double)

public function flu_tonumber(L, index) result(number)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value real

public function flu_toBoolean(L, index) result(bool)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value logical

public function flu_touserdata(L, index) result(ptr)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value type(c_ptr)

public function flu_topointer(L, index) result(intptr)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value integer(kind=long_k)

public function flu_type(L, index) result(flut)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value integer

public function flu_getmetatable(L, index) result(errcode)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

Return Value integer

public function fluL_loadfile(L, filename) result(errcode)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
character(len=*) :: filename

Return Value integer

public function fluL_loadbuffer(L, buffer, bufName) result(errcode)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
character(len=1) :: buffer(:)
character(len=*), optional :: bufName

Return Value integer

public function fluL_loadstring(L, string) result(errcode)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
character(len=*) :: string

Return Value integer

public function fluL_newstate() result(new_state)

Arguments

None

Return Value type(flu_State)

public function fluL_newmetatable(L, tname) result(errcode)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
character(len=*) :: tname

Return Value integer

public function fluL_ref(L, t) result(ref)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: t

Return Value integer

public function flu_copyptr(lua_state) result(L)

Copy an existing Lua state.

Read more…

Arguments

Type IntentOptional Attributes Name
type(c_ptr), intent(in) :: lua_state

Return Value type(flu_State)

public function flu_isopen(L) result(is_open)

Arguments

Type IntentOptional Attributes Name
type(flu_State), intent(in) :: L

Return Value logical


Subroutines

public subroutine flu_close(L)

Close a previously opened Lua script.

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L

Handle to the Lua state to close.

public subroutine flu_createtable(L, narr, nrec)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: narr
integer :: nrec

public subroutine flu_insert(L, index)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

public subroutine flu_pop(L, n)

Wrapper for lua_pop that pops n elements from the Lua API stack.

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L

Handle to the Lua script

integer, intent(in), optional :: n

Number of elements to pop from the Lua API stack, defaults to 1.

public subroutine flu_pushboolean(L, b)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
logical :: b

public subroutine flu_pushstring(L, string)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
character(len=*), intent(in) :: string

public subroutine flu_pushnil(L)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L

public subroutine flu_pushvalue(L, index)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index

public subroutine flu_pushlightuserdata(L, ptr)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
type(c_ptr) :: ptr

public subroutine flu_settable(L, n)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer, intent(in) :: n

public subroutine flu_settop(L, n)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer, intent(in) :: n

public subroutine flu_setfield(L, index, k)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer :: index
character(len=*) :: k

public subroutine flu_setglobal(L, k)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
character(len=*), intent(in) :: k

public subroutine flu_pushcclosure(L, fn, n)

Arguments

Type IntentOptional Attributes Name
type(flu_State), value :: L
procedure(lua_Function) :: fn
integer :: n

public subroutine flu_register(L, fn_name, fn)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
character(len=*), intent(in) :: fn_name
procedure(lua_Function) :: fn

public subroutine fluL_openlibs(L)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L

public subroutine fluL_setmetatable(L, tname)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
character(len=*) :: tname

public subroutine flu_free_cbuf(buf)

Free an allocated cbuf.

Read more…

Arguments

Type IntentOptional Attributes Name
type(cbuf_type) :: buf

private subroutine flu_pushint(L, n)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer(kind=int_k) :: n

private subroutine flu_pushlong(L, n)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
integer(kind=long_k) :: n

private subroutine flu_pushreal(L, n)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
real :: n

private subroutine flu_pushdouble(L, n)

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
real(kind=c_double) :: n

private subroutine flu_dump_toBuf(L, buf, length, iError)

Dump to a buffer and return the pointer to the resulting string.

Arguments

Type IntentOptional Attributes Name
type(flu_State) :: L
type(cbuf_type), intent(out) :: buf
integer :: length
integer :: iError