Jump to content
  • 1

[42.5.1] [Rev:27373] Lua mod files are not loaded in alphabetical order on Linux


Question

Posted (edited)

Version: 42.3.1+ (still present on 42.5.1) (Linux x86_64)

Mode: Singleplayer

Mods: Any with multiple files that require alphabetical load order, Bikinitools is a good example, but it is not specific to Bikinitools.

Save: N/A, happens on game bootup as well

Reproduction steps:

1. Have a mod that uses multiple files that require alphabetical loading (e.g. named 01_foo.lua, 10_baz.lua, 99_bar.lua). Bikinitools is a good example.

2. Enable the mod and load PZ.

3. The mod lua files will be loaded in the wrong order (rather than alphabetical), which causes the mod to error and print tracebacks.

 

As an example of one of the tracebacks, and why I believe it is due to an ordering bug:

 

function: 11_BT_VehiclePart.lua -- file: 11_BT_VehiclePart.lua line # 1 | MOD: bikinitools v51 [B42].
[27-02-25 14:39:27.714] ERROR: General      f:0, t:1740627567714> ExceptionLogger.logException> Exception thrown
	java.lang.RuntimeException: attempted index: VehiclePart of non-table: null at KahluaThread.tableget(KahluaThread.java:1667).

 

This is from the line of code in 11_BT_VehiclePart.lua:

function Bikinitools.VehiclePart:isMissing(part)

 

Which is set up in 00_BT_Base.lua like so:

 

Bikinitools.VehiclePart = {};

 

 

All the other tracebacks are similar. It appears like this is a Zomboid bug specific to Linux since all I can find about Lua loading says that it happens in that alphabetical order, and this isn't affecting the majority of people so I'm chalking it down to being a Linux user :)

 

I don't think there's a way to log which files are being loaded in what order, and the filename is missing the directory path, but if we take bikinitools/42/media/lua/client/Automation as an example, the tracebacks are logged in this order, which demonstrates how it's not alphabetical.

 

function: Farmer.lua -- file: Farmer.lua line # 3 | MOD: bikinitools v50 [B42].
function: ContainerUnloader.lua -- file: ContainerUnloader.lua line # 3 | MOD: bikinitools v50 [B42].
function: GravelBuddy.lua -- file: GravelBuddy.lua line # 3 | MOD: bikinitools v50 [B42].
function: Gardener.lua -- file: Gardener.lua line # 3 | MOD: bikinitools v50 [B42].
function: CorpseStacker.lua -- file: CorpseStacker.lua line # 3 | MOD: bikinitools v50 [B42].
function: Lumberjack.lua -- file: Lumberjack.lua line # 3 | MOD: bikinitools v50 [B42].
function: HomeWrecker.lua -- file: HomeWrecker.lua line # 3 | MOD: bikinitools v50 [B42].

 

This also appears to affect other mods like Spongie's Character Customisation, although I haven't looked into that too much.

 

Edited by hawkowl
add 42.5.1 note

3 answers to this question

Recommended Posts

  • 0
Posted

Still present in 42.5.1. Also not sure why this was moved to PZ Support, since this is a Zomboid bug, not a bug in any of these mods.

  • 0
Posted

Just curious, have the devs ever said that file load order is guaranteed to be alphabetical?  If they have then I'd agree that its a bug; if they haven't said that it might not be - although still something I'd want fixed because I know a lot of mods rely on that.

  • 0
Posted

 This post from robomat says that is what is meant to happen, but I haven't found anything directly from the devs, I think. The code to alphabetically sort the files before loading it does exist in Zomboid though if you disasm the code of zombie.Lua.LuaManager.LoadDir (or one of the functions it uses in that class -- I only had a cursory look). If I run the game via Proton, the mods load fine even though it's the same underlying Java and Lua files. It's very strange! I'm not even using a weird filesystem either, just normal old ext4 on Fedora 41.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...