Lost on Lua Modding Resources

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
Aniketos
Posts: 2
Joined: Tue, 18. Dec 18, 06:03
x4

Lost on Lua Modding Resources

Post by Aniketos » Thu, 14. Mar 24, 08:35

Henlo!

TL;DR: is there some sort of reference material or documentation available on X4/X:R's core Lua library?

I've recently begun tinkering with X4 modding - at present using Sir Nuke's Named Pipes Lua library to interface with an external application - but I'm finding myself a bit lost for lack of reference material and documentation regarding the game's Lua library. Admittedly I'm new to Lua and X4 modding on the whole, but I have worked in software development for nearly two decades and feel I've been adapting to Lua fairly quickly. But I could really use some help in finding reference material or documentation!

IIRC there used to be more useful information on the old Confluence wiki (?), but since the transition to the new platform, the pickings feel sparse, and often reference links to the old wiki which no longer function. In tens of hours scouring catalogue files, wikis, forums, reddit, open source repositories, and mod implementations, I've been unable to find answers to some basic questions I've encountered - like what do global functions like

Code: Select all

DebugError()
,

Code: Select all

RegisterEvent()
, and

Code: Select all

AddUITriggeredEvent()
do? What are their signatures? Can I handle a

Code: Select all

AddUITriggeredEvent()
with a

Code: Select all

RegisterEvent()
?

As far as I can tell, the declarations for the core X4 Lua library are not contained in the game's catalogue archives, are not described on the wiki, are not listed in function and FFI dumps in miscellaneous GitHub Gists, and are not referenced in any resource pointed to by pinned forum posts or wiki articles. I think I can probably sort out the gist by pouring more hours into reading published mods' code and trial and error, but surely, hopefully, there is some more robust resource that I've been overlooking?

Thank you for your time and consideration. Cheers :)

User avatar
X2-Illuminatus
Moderator (Deutsch)
Moderator (Deutsch)
Posts: 24965
Joined: Sun, 2. Apr 06, 16:38
x4

Re: Lost on Lua Modding Resources

Post by X2-Illuminatus » Thu, 14. Mar 24, 17:12

There is a UI modding support page on the X Rebirth Wiki, including a subpage about Lua functions.
Nun verfügbar! X3: Farnham's Legacy - Ein neues Kapitel für einen alten Favoriten

Die komplette X-Roman-Reihe jetzt als Kindle E-Books! (Farnhams Legende, Nopileos, X3: Yoshiko, X3: Hüter der Tore, X3: Wächter der Erde)

Neuauflage der fünf X-Romane als Taschenbuch

The official X-novels Farnham's Legend, Nopileos, X3: Yoshiko as Kindle e-books!

Aniketos
Posts: 2
Joined: Tue, 18. Dec 18, 06:03
x4

Re: Lost on Lua Modding Resources

Post by Aniketos » Thu, 14. Mar 24, 18:21

X2-Illuminatus wrote:
Thu, 14. Mar 24, 17:12
There is a UI modding support page on the X Rebirth Wiki, including a subpage about Lua functions.
Thanks for the reply :)

I have been using those resources (and I really do appreciate that they're available at all!), but was still hoping there might be something a little more... complete, or perhaps descriptive. Of the examples in my post, the Lua function list doesn't include RegisterEvent() (edit: ahh, it's in the Widgetsystem function overview), and the entry for DebugError() lacks any description or function signature.

As a modding n00b I find myself running into such instances fairly frequently, where I can't be entirely sure of a function's purpose or arguments and struggle to find a definition... I can usually suss out the details through reading through the core Lua scripts and those from mods and trial and error... And that's totally fine! It just takes a bit of a time investment, and I guess I was just hoping for some resource which might help me get up to speed a little more rapidly.

Ultimately though, I reckon this is only a short-term problem - perseverance will get me there :thumb_up:. Lua modding is just a little difficult to break into. There doesn't seem to be much in the way of introductory material - but maybe, if I reach a point of comfort and competence - I can one day double back and provide that myself :)

Post Reply

Return to “X4: Foundations - Scripts and Modding”