Name
hw_GetVMErrorInfo -- get extended error information from VM (V6.1)
Synopsis
int error = hw_GetVMErrorInfo(lua_State *L, struct hwGVMErrorInfo *vme,
                struct hwTagList *tags);
Function
This function can be used to obtain extended error information from the Lua VM in case lua_pcall() exited with an error code, i.e. lua_pcall() returned anything except 0. You have to pass the lua_State pointer and a pointer to a struct hwGVMErrorInfo to this function. hw_GetVMErrorInfo() will then fill the struct hwGVMErrorInfo with extended error information. struct hwGVMErrorInfo looks like this:

 
struct hwGVMErrorInfo
{
    int Line;
    STRPTR Function;
    STRPTR File;
};

hw_GetVMErrorInfo() will write the following information to the structure pointer passed to it:

Line:
This will be set to the line number in the script where the error occurred.

Function:
This will be set to a string containing the name of the function in which the error occurred.

File:
This will be set to a string containing the name of the file in which the error occurred.

Note that you should call hw_GetVMErrorInfo() right after lua_pcall() has returned with an error code. Otherwise there is no guarantee that the returned information is still valid.

Designer compatibility
Unsupported

Inputs
L
pointer to the lua_State
vme
pointer to a struct hwGVMErrorInfo to be filled by the function
tags
reserved for future use; pass NULL for the time being
Results
error
error code or 0 for success

Show TOC