Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: layout change

...

If you take a look at certain Lua files (for instance ego_detailmonitor/menu_map.lua or ego_detailmonitor/menu_missionbriefing.lua, you will find sections on top a file looking like this:

FFI-definition

 

...

Code Block

...

title

...

-- ffi setup

...

FFI-definition
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
linenumberstrue
-- ffi setup
local ffi = require("ffi")

...


local C = ffi.C

...


ffi.cdef[[

...


    typedef uint64_t UniverseID;

...

    typedef struct {
        const char* factionName;
        const char* factionIcon;
    } OwnerDetails;
    UniverseID AddHoloMap(const char* texturename, float x0, float x1, float y0, float y1);
    void ClearHighlightMapComponent(UniverseID holomapid);
    const char* GetBuildSourceSequence(UniverseID componentid);
    const char* GetComponentClass(UniverseID componentid);
    const char* GetComponentName(UniverseID componentid);
    uint64_t GetContextByClass(UniverseID componentid, const char* classname, bool includeself);
    uint64_t GetMapComponentBelowCamera(UniverseID holomapid);
    const char* GetMapShortName(UniverseID componentid);
    OwnerDetails GetOwnerDetails(UniverseID componentid);
    uint64_t GetParentComponent(UniverseID componentid);
    uint64_t GetPickedMapComponent(UniverseID holomapid);
    bool IsComponentOperational(UniverseID componentid);
    bool IsInfoUnlockedForPlayer(UniverseID componentid, const char* infostring);
    bool IsSellOffer(UniverseID tradeofferdockid);
    void RemoveHoloMap(UniverseID holomapid);
    void SetHighlightMapComponent(UniverseID holomapid, UniverseID componentid, bool resetplayerpan);
    void ShowUniverseMap(UniverseID holomapid, UniverseID componentid, bool resetplayerzoom, int overridezoom);
    void StartPanMap(UniverseID holomapid);
    void StartRotateMap(UniverseID holomapid);
    void StopPanMap(UniverseID holomapid);
    void StopRotateMap(UniverseID holomapid);
    void ZoomMap(UniverseID holomapid, float zoomstep);

    typedef struct {
        const char* factionName;
        const char* factionIcon;
    } OwnerDetails;
    UniverseID AddHoloMap(const char* texturename, float x0, float x1, float y0, float y1);
    void ClearHighlightMapComponent(UniverseID holomapid);
    const char* GetBuildSourceSequence(UniverseID componentid);
    const char* GetComponentClass(UniverseID componentid);
    const char* GetComponentName(UniverseID componentid);
    uint64_t GetContextByClass(UniverseID componentid, const char* classname, bool includeself);
    uint64_t GetMapComponentBelowCamera(UniverseID holomapid);
    const char* GetMapShortName(UniverseID componentid);
    OwnerDetails GetOwnerDetails(UniverseID componentid);
    uint64_t GetParentComponent(UniverseID componentid);
    uint64_t GetPickedMapComponent(UniverseID holomapid);
    bool IsComponentOperational(UniverseID componentid);
    bool IsInfoUnlockedForPlayer(UniverseID componentid, const char* infostring);
    bool IsSellOffer(UniverseID tradeofferdockid);
    void RemoveHoloMap(UniverseID holomapid);
    void SetHighlightMapComponent(UniverseID holomapid, UniverseID componentid, bool resetplayerpan);
    void ShowUniverseMap(UniverseID holomapid, UniverseID componentid, bool resetplayerzoom, int overridezoom);
    void StartPanMap(UniverseID holomapid);
    void StartRotateMap(UniverseID holomapid);
    void StopPanMap(UniverseID holomapid);
    void StopRotateMap(UniverseID holomapid);
    void ZoomMap(UniverseID holomapid, float zoomstep);
]]

 

This is the so called FFI (fast function interface). It has certain advantages over simple Lua functions, especially with regards to performance and stability. Therefore we aim to deprecate the Lua interface in the long run and replace everything with corresponding FFI-functions.

...