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(len=1), | 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. |
subroutine open_config_buffer(L, buffer, bufName, ErrCode, ErrString) type(flu_State) :: L !! Handle to the Lua script !> String with Lua code to load. character, intent(in) :: buffer(:) !> Name for the buffer to use in debug messages. character(len=*), intent(in), optional :: bufName !> 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. integer, intent(out), optional :: ErrCode !> 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. character(len=*), intent(out), optional :: ErrString integer :: err if (.not.flu_isopen(L)) L = fluL_newstate() err = fluL_loadbuffer(L, buffer, bufName) call aot_err_handler(L, err, 'Cannot load buffer:', ErrString, ErrCode) if (err == 0) then call fluL_openlibs(L) err = flu_pcall(L, 0, 0, 0) call aot_err_handler(L, err, 'Cannot run buffer:', ErrString, ErrCode) end if end subroutine open_config_buffer