aot_get_val Interface

public interface aot_get_val

Get a value from the Lua script.

This is the central interface to retrieve values from a Lua script, its general shape looks like call aot_{top}_get_val(<outputs>, <id>, default). Where the "outputs" are val and errCode. While "id" is at least the Lua context L. For global variables there has to be a key to identify the variable.

The errCode returns an error code with various bits set for different errors that might happen while retrieving the variable. They can be checked by btest and the different error codes are:

For example a check for a fatal error can be done by btest(errCode, aoterr_fatal).

For the access to global variables in the Lua script the interface therefore, looks like: call aot_get_val(val, errCode, L, key, default).

The interface to access table values looks like: call aot_get_val(val, errCode, L, thandle, key, pos, default). Position pos and key are both optional, but one of them has to be provided. If both are provided the key takes precedence over the pos, and the pos will only be tried if the access to the key fails. See for example get_table_real for a more detailed description of the parameters.

Calls

interface~~aot_get_val~3~~CallsGraph interface~aot_get_val~3 aot_get_val proc~get_table_real get_table_real interface~aot_get_val~3->proc~get_table_real proc~get_table_integer get_table_integer interface~aot_get_val~3->proc~get_table_integer proc~get_table_string get_table_string interface~aot_get_val~3->proc~get_table_string proc~get_table_logical get_table_logical interface~aot_get_val~3->proc~get_table_logical proc~get_table_long get_table_long interface~aot_get_val~3->proc~get_table_long proc~get_table_double get_table_double interface~aot_get_val~3->proc~get_table_double proc~get_table_userdata get_table_userdata interface~aot_get_val~3->proc~get_table_userdata proc~aot_table_push aot_table_push proc~get_table_real->proc~aot_table_push interface~aot_top_get_val aot_top_get_val proc~get_table_real->interface~aot_top_get_val proc~flu_getglobal flu_getglobal proc~get_table_real->proc~flu_getglobal proc~get_table_integer->proc~aot_table_push proc~get_table_integer->interface~aot_top_get_val proc~get_table_integer->proc~flu_getglobal proc~get_table_string->proc~aot_table_push proc~get_table_string->interface~aot_top_get_val proc~get_table_string->proc~flu_getglobal proc~get_table_logical->proc~aot_table_push proc~get_table_logical->interface~aot_top_get_val proc~get_table_logical->proc~flu_getglobal proc~get_table_long->proc~aot_table_push proc~get_table_long->interface~aot_top_get_val proc~get_table_long->proc~flu_getglobal proc~get_table_double->proc~aot_table_push proc~get_table_double->interface~aot_top_get_val proc~get_table_double->proc~flu_getglobal proc~get_table_userdata->proc~aot_table_push proc~get_table_userdata->interface~aot_top_get_val proc~get_table_userdata->proc~flu_getglobal proc~aot_table_push->proc~flu_getglobal proc~flu_pushnil flu_pushnil proc~aot_table_push->proc~flu_pushnil proc~flu_gettable flu_gettable proc~aot_table_push->proc~flu_gettable interface~flu_pushinteger flu_pushinteger proc~aot_table_push->interface~flu_pushinteger proc~flu_getfield flu_getfield proc~aot_table_push->proc~flu_getfield proc~flu_type flu_type proc~aot_table_push->proc~flu_type proc~flu_pop flu_pop proc~aot_table_push->proc~flu_pop proc~aot_top_get_double aot_top_get_double interface~aot_top_get_val->proc~aot_top_get_double proc~aot_top_get_integer aot_top_get_integer interface~aot_top_get_val->proc~aot_top_get_integer proc~aot_top_get_logical aot_top_get_logical interface~aot_top_get_val->proc~aot_top_get_logical proc~aot_top_get_long aot_top_get_long interface~aot_top_get_val->proc~aot_top_get_long proc~aot_top_get_real aot_top_get_real interface~aot_top_get_val->proc~aot_top_get_real proc~aot_top_get_string aot_top_get_string interface~aot_top_get_val->proc~aot_top_get_string proc~aot_top_get_userdata aot_top_get_userdata interface~aot_top_get_val->proc~aot_top_get_userdata interface~lua_getglobal lua_getglobal proc~flu_getglobal->interface~lua_getglobal proc~aot_top_get_double->proc~flu_pop proc~flu_isnumber flu_isnumber proc~aot_top_get_double->proc~flu_isnumber proc~flu_isnoneornil flu_isNoneOrNil proc~aot_top_get_double->proc~flu_isnoneornil proc~flu_todouble flu_todouble proc~aot_top_get_double->proc~flu_todouble interface~lua_pushnil lua_pushnil proc~flu_pushnil->interface~lua_pushnil interface~lua_gettable lua_gettable proc~flu_gettable->interface~lua_gettable proc~flu_pushint flu_pushint interface~flu_pushinteger->proc~flu_pushint proc~flu_pushlong flu_pushlong interface~flu_pushinteger->proc~flu_pushlong proc~aot_top_get_integer->proc~flu_pop proc~aot_top_get_integer->proc~flu_isnumber proc~aot_top_get_integer->proc~flu_isnoneornil proc~aot_top_get_integer->proc~flu_todouble proc~aot_top_get_logical->proc~flu_pop proc~flu_toboolean flu_toBoolean proc~aot_top_get_logical->proc~flu_toboolean proc~flu_isboolean flu_isBoolean proc~aot_top_get_logical->proc~flu_isboolean proc~aot_top_get_logical->proc~flu_isnoneornil interface~lua_getfield lua_getfield proc~flu_getfield->interface~lua_getfield proc~aot_top_get_long->proc~flu_pop proc~aot_top_get_long->proc~flu_isnumber proc~aot_top_get_long->proc~flu_isnoneornil proc~aot_top_get_long->proc~flu_todouble interface~lua_type lua_type proc~flu_type->interface~lua_type interface~lua_settop lua_settop proc~flu_pop->interface~lua_settop proc~aot_top_get_real->proc~flu_pop proc~aot_top_get_real->proc~flu_isnumber proc~aot_top_get_real->proc~flu_isnoneornil proc~flu_tonumber flu_tonumber proc~aot_top_get_real->proc~flu_tonumber proc~aot_top_get_string->proc~flu_pop proc~flu_tolstring flu_tolstring proc~aot_top_get_string->proc~flu_tolstring proc~aot_top_get_string->proc~flu_isnoneornil proc~flu_isstring flu_isString proc~aot_top_get_string->proc~flu_isstring proc~aot_top_get_userdata->proc~flu_pop proc~aot_top_get_userdata->proc~flu_isnoneornil proc~flu_islightuserdata flu_islightuserdata proc~aot_top_get_userdata->proc~flu_islightuserdata proc~flu_touserdata flu_touserdata proc~aot_top_get_userdata->proc~flu_touserdata interface~lua_toboolean lua_toboolean proc~flu_toboolean->interface~lua_toboolean interface~lua_isnumber lua_isNumber proc~flu_isnumber->interface~lua_isnumber interface~lua_pushinteger lua_pushinteger proc~flu_pushint->interface~lua_pushinteger proc~flu_isboolean->interface~lua_type interface~lua_tolstring lua_tolstring proc~flu_tolstring->interface~lua_tolstring proc~flu_isnoneornil->interface~lua_type proc~flu_islightuserdata->interface~lua_type interface~lua_touserdata lua_touserdata proc~flu_touserdata->interface~lua_touserdata interface~lua_tonumberx lua_tonumberx proc~flu_todouble->interface~lua_tonumberx interface~lua_isstring lua_isString proc~flu_isstring->interface~lua_isstring proc~flu_pushlong->interface~lua_pushinteger proc~flu_tonumber->interface~lua_tonumberx

Contents


Module Procedures

private subroutine get_table_real(val, ErrCode, L, thandle, key, pos, default)

Retrieve a single precision real value from a table.

Arguments

Type IntentOptional AttributesName
real(kind=single_k), intent(out) :: val

Value of the table entry if it exists.

integer, intent(out) :: ErrCode

Error code to indicate what kind of problem might have occured.

type(flu_State) :: L

Handle to the Lua script.

integer, intent(in), optional :: thandle

Handle to the table to look the value up in.

character(len=*), intent(in), optional :: key

Name of the entry to look for.

Key and pos are both optional, however at least one of them has to be supplied. The key takes precedence over the pos if both are given.

integer, intent(in), optional :: pos

Position of the entry to look for in the table.

It allows the access to unnamed arrays in the Lua tables.

real(kind=single_k), intent(in), optional :: default

Some default value, that should be used, if the variable is not set in the Lua script.

private subroutine get_table_double(val, ErrCode, L, thandle, key, pos, default)

Retrieve a double precision real value from a table.

Arguments

Type IntentOptional AttributesName
real(kind=double_k), intent(out) :: val

Value of the table entry if it exists.

integer, intent(out) :: ErrCode

Error code to indicate what kind of problem might have occured.

type(flu_State) :: L

Handle to the Lua script.

integer, intent(in), optional :: thandle

Handle to the table to look the value up in.

character(len=*), intent(in), optional :: key

Name of the entry to look for.

Key and pos are both optional, however at least one of them has to be supplied. The key takes precedence over the pos if both are given.

integer, intent(in), optional :: pos

Position of the entry to look for in the table.

It allows the access to unnamed arrays in the Lua tables.

real(kind=double_k), intent(in), optional :: default

Some default value, that should be used, if the variable is not set in the Lua script.

private subroutine get_table_integer(val, ErrCode, L, thandle, key, pos, default)

Retrieve a default integer value from a table.

Arguments

Type IntentOptional AttributesName
integer(kind=int_k), intent(out) :: val

Value of the table entry if it exists.

integer, intent(out) :: ErrCode

Error code to indicate what kind of problem might have occured.

type(flu_State) :: L

Handle to the Lua script.

integer, intent(in), optional :: thandle

Handle to the table to look the value up in.

character(len=*), intent(in), optional :: key

Name of the entry to look for.

Key and pos are both optional, however at least one of them has to be supplied. The key takes precedence over the pos if both are given.

integer, intent(in), optional :: pos

Position of the entry to look for in the table.

It allows the access to unnamed arrays in the Lua tables.

integer(kind=int_k), intent(in), optional :: default

Some default value, that should be used, if the variable is not set in the Lua script.

private subroutine get_table_long(val, ErrCode, L, thandle, key, pos, default)

Retrieve a long integer value from a table.

Arguments

Type IntentOptional AttributesName
integer(kind=long_k), intent(out) :: val

Value of the table entry if it exists.

integer, intent(out) :: ErrCode

Error code to indicate what kind of problem might have occured.

type(flu_State) :: L

Handle to the Lua script.

integer, intent(in), optional :: thandle

Handle to the table to look the value up in.

character(len=*), intent(in), optional :: key

Name of the entry to look for.

Key and pos are both optional, however at least one of them has to be supplied. The key takes precedence over the pos if both are given.

integer, intent(in), optional :: pos

Position of the entry to look for in the table.

It allows the access to unnamed arrays in the Lua tables.

integer(kind=long_k), intent(in), optional :: default

Some default value, that should be used, if the variable is not set in the Lua script.

private subroutine get_table_string(val, ErrCode, L, thandle, key, pos, default)

Retrieve a string from a table.

Arguments

Type IntentOptional AttributesName
character(len=*) :: val

Value of the table entry if it exists.

integer, intent(out) :: ErrCode

Error code to indicate what kind of problem might have occured.

type(flu_State) :: L

Handle to the Lua script.

integer, intent(in), optional :: thandle

Handle to the table to look the value up in.

character(len=*), intent(in), optional :: key

Name of the entry to look for.

Key and pos are both optional, however at least one of them has to be supplied. The key takes precedence over the pos if both are given.

integer, intent(in), optional :: pos

Position of the entry to look for in the table.

It allows the access to unnamed arrays in the Lua tables.

character(len=*), intent(in), optional :: default

Some default value, that should be used, if the variable is not set in the Lua script.

private subroutine get_table_logical(val, ErrCode, L, thandle, key, pos, default)

Retrieve a logical value from a table.

Arguments

Type IntentOptional AttributesName
logical, intent(out) :: val

Value of the table entry if it exists.

integer, intent(out) :: ErrCode

Error code to indicate what kind of problem might have occured.

type(flu_State) :: L

Handle to the Lua script.

integer, intent(in), optional :: thandle

Handle to the table to look the value up in.

character(len=*), intent(in), optional :: key

Name of the entry to look for.

Key and pos are both optional, however at least one of them has to be supplied. The key takes precedence over the pos if both are given.

integer, intent(in), optional :: pos

Position of the entry to look for in the table.

It allows the access to unnamed arrays in the Lua tables.

logical, intent(in), optional :: default

Some default value, that should be used, if the variable is not set in the Lua script.

private subroutine get_table_userdata(val, ErrCode, L, thandle, key, pos, default)

Retrieve a userdata value (generic C pointer) from a table.

Arguments

Type IntentOptional AttributesName
type(c_ptr), intent(out) :: val

Value of the table entry if it exists.

integer, intent(out) :: ErrCode

Error code to indicate what kind of problem might have occured.

type(flu_State) :: L

Handle to the Lua script.

integer, intent(in), optional :: thandle

Handle to the table to look the value up in.

character(len=*), intent(in), optional :: key

Name of the entry to look for.

Key and pos are both optional, however at least one of them has to be supplied. The key takes precedence over the pos if both are given.

integer, intent(in), optional :: pos

Position of the entry to look for in the table.

It allows the access to unnamed arrays in the Lua tables.

type(c_ptr), intent(in), optional :: default

Some default value, that should be used, if the variable is not set in the Lua script.