This module provides high level Fortran interfaces to retrieve values from a Lua script.
The central interface of the module is aot_get_val, which is a generic interface that allows access to scalars and vectors in global Lua variables as well as nested tables.
In the Overview there are some more general remarks and further pointers.
Subroutine to load and execute a script from a file.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(flu_State) | :: | L | Handle to the Lua script |
|||
character(len=*), | intent(in) | :: | filename | Name of file to load the Lua code from |
||
integer, | intent(out), | optional | :: | ErrCode | Error code returned by Lua during loading or executing the file. This optional parameter might be used to react on errors in the calling side. If neither ErrCode nor ErrString are given, this subroutine will stop the program execution and print the error message from Lua to the stdout. |
|
character(len=*), | intent(out), | optional | :: | ErrString | Obtained error description from the Lua stack. This optional argument holds the Lua error message in case somehting went wrong. It can be used to provide some feedback to the user in the calling routine. If neither ErrCode nor ErrString are provided, open_config() will print the error message and stop program execution. |
|
type(cbuf_type), | intent(out), | optional | :: | buffer | Optional argument to return the compiled script after loading it to the caller. It might be handy to reuse the loaded script later on, this argument allows you to obtain the script in compiled form, before it is executed. The buffer will be allocated and filled with the Lua data. It contains the actual string in buffer%buffer which is a character pointer, and the original c_ptr to this |
Subroutine to load and execute a script given in a string.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(flu_State) | :: | L | Handle to the Lua script |
|||
character(len=*), | intent(in) | :: | chunk | String with Lua code to load. |
||
integer, | intent(out), | optional | :: | ErrCode | Error code returned by Lua during loading or executing the file. This optional parameter might be used to react on errors in the calling side. If neither ErrCode nor ErrString are given, this subroutine will stop the program execution and print the error message from Lua to the stdout. |
|
character(len=*), | intent(out), | optional | :: | ErrString | Obtained error description from the Lua stack. This optional argument holds the Lua error message in case something went wrong. It can be used to provide some feedback to the user in the calling routine. If neither ErrCode nor ErrString are provided, open_config() will print the error message and stop program execution. |
Subroutine to load and execute a script given in a buffer (bytecode).
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(flu_State) | :: | L | Handle to the Lua script |
|||
character, | intent(in) | :: | buffer(:) | String with Lua code to load. |
||
character(len=*), | intent(in), | optional | :: | bufName | Name for the buffer to use in debug messages. |
|
integer, | intent(out), | optional | :: | ErrCode | Error code returned by Lua during loading or executing the file. This optional parameter might be used to react on errors in the calling side. If neither ErrCode nor ErrString are given, this subroutine will stop the program execution and print the error message from Lua to the stdout. |
|
character(len=*), | intent(out), | optional | :: | ErrString | Obtained error description from the Lua stack. This optional argument holds the Lua error message in case somehting went wrong. It can be used to provide some feedback to the user in the calling routine. If neither ErrCode nor ErrString are provided, open_config() will print the error message and stop program execution. |
Close an opened Lua script again.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(flu_State) | :: | L | Handle to the Lua script to close. |
Subroutine to load a script from a file and put it into a character buffer.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | filename | Name of file to load the Lua code from |
||
type(cbuf_type), | intent(out) | :: | buffer | Buffer to store the script in the given file in |
||
integer, | intent(out), | optional | :: | ErrCode | Error code returned by Lua during loading or executing the file. This optional parameter might be used to react on errors in the calling side. If neither ErrCode nor ErrString are given, this subroutine will stop the program execution and print the error message from Lua to the stdout. |
|
character(len=*), | intent(out), | optional | :: | ErrString | Obtained error description from the Lua stack. This optional argument holds the Lua error message in case somehting went wrong. It can be used to provide some feedback to the user in the calling routine. If neither ErrCode nor ErrString are provided, open_config() will print the error message and stop program execution. |
Load and execute a given buffer and register it in the package table as the given module name.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(flu_State) | :: | L | Lua State to set load the buffer into. |
|||
character, | intent(in) | :: | buffer(:) | Buffer to load. |
||
character(len=*), | intent(in) | :: | modname | Module name to set. |