Lua standard library extensions

Feedback on past, current, and future development.
Post Reply
C3pa
Posts: 13
Joined: 26 Dec 2018, 21:26
Location: Croatia

Lua standard library extensions

Post by C3pa »

Lua, being a lightweight language also means that its standard library is really small. I'd like if OpenMW would include some helpful, commonly used functions.

Here I compiled a list of the functions that MWSE extends the standard Lua with. I added a link to the MWSE's documentation description of each function. The numbers in the second row indicate the number of uses in all the currently released MWSE-lua mods, which were obtained by using GitHub's search in morrowind-nexus-lua-dump repository. There can be some false positives. For example, searching "table.size" would also list a file that has the words "table" and "size" in the comments. However, the number of false positives shouldn't be that high to significantly skew the numbers (my estimation, based on a quick scroll-over of the search results). Only for the functions that have a small number of hits, I've counted the real usage myself. So, these statistics show us how useful the modders find each of the functions. Bear in mind that not all the functions listed here were added to MWSE at the same time, so there wasn't the same amount of time for modders to start using each of those.

String library
Function, Usage: Math library
Function, Usage: Table library:
Function, Usage: All of these functions in MWSE are implemented in pure Lua, and I can link to the implementation if desired.

The motivation to include these:
  • Most of the modders aren't software developers. Having helper functions should make it easier to script something in OpenMW.
  • The ones that have used MWSE will be familiar with these.
I see two important points to discuss:
  1. Which functions to include? Will we define a certain threshold and include all the functions with a number of uses higher than the threshold?
  2. How to name the functions? Will they be exposed in the global namespace or will be inside a package (e.g. openmw_aux.util)?
User avatar
wazabear
Posts: 96
Joined: 13 May 2020, 19:31
Gitlab profile: https://gitlab.com/glassmancody.info

Re: Lua standard library extensions

Post by wazabear »

Hi!

If you don't mind could you open an issue on Gitlab (feel free to copy/paste parts of your original post)
https://gitlab.com/OpenMW/openmw/-/issues.

Chances of gaining traction for these things is much higher if posted directory on the issue tracker.
Post Reply