The following procedure is required to issue an LUA verb. In this example, the verb issued is RUI_INIT.
#include <winlua.h>
.
.
struct LUA_VERB_RECORD rui_init;
The LUA_VERB_RECORD structure is declared in the WINLUA.H header file.
memset( &rui_init, 0, sizeof( rui_init) );
LUA requires that all reserved parameters, and all parameters not required by the verb being issued, must be set to zero. The simplest way to do this is to set the entire VCB to zeros before setting the parameters required for this particular verb.
rui_init.common.lua_verb = LUA_VERB_RUI;
rui_init.common.lua_verb_length = sizeof(struct LUA_COMMON);
rui_init.common.lua_opcode = LUA_OPCODE_RUI_INIT;
memcpy (rui_init.common.lua_luname, "THISLU ", 8);
The values LUA_VERB_RUI and LUA_OPCODE_RUI_INIT are symbolic constants. These constants are defined in the WINLUA.H header file in the SNA Server Software Development Kit. To ensure portability between different systems, use symbolic constants and not integer values.
RUI( &rui_init );
if (rui_init.common.lua_flag2.async)
{
/* verb will complete asynchronously so continue
with other processing */
/* then wait */
WaitForSingleObject (...)
}
Do not check the return code; it may have changed from LUA_IN_PROGRESS to LUA_OK by the time you check it.
if( rui_init.common.lua_prim_rc == LUA_OK )
{
/* Init OK */
.
.
}
else
{
/* Do error routine */
.
.
}