Mediator functions

LuaFAR 3

Mediator functions


Functions in this sections act as mediators between the plugin’s exported functions and their counterparts written in Lua.

When FAR calls an exported function, the latter in turn calls a mediator passing it a Lua State pointer as the first argument, followed by all the arguments it received from FAR.

The mediator then calls a corresponding Lua function, passing it the arguments converted to their Lua equivalents, receives return value(s) from Lua, converts them to their C equivalents and returns them to its caller (the exported function).

Example:

1) FAR calls the exported function OpenW:

  HANDLE OpenW(const struct OpenInfo *Info)

2) OpenW calls the mediator function LF_Open:

  HANDLE LF_Open (lua_State* L, const struct OpenInfo *Info)

3) LF_Open calls the Lua function export.Open:

  export.Open (aFrom, aGuid, aItem)