attempt to index global 'unified_inventory' (a boolean value) error message
DustyBagel opened this issue · comments
If you try to run a world with PipeWorks, moreores, basic materials, and xboxs enabled, you get this error message:
2023-11-20 19:33:01: ERROR[Main]: ...t\dev\minetest\bin\Release....\mods\pipeworks\init.lua:207: attempt to index global 'unified_inventory' (a boolean value)
In order to get this error message, you need to have pipeworks, moreores, basic materials, and xbows installed at the same time. I don't know why you need all of these for it to not work but that's how I got it. I don't know if it is something on the pipeworks end or on the other mod's end, but something is causing this issue. I do however have a fix for this issue. If you replace the lines 207 to 215 in the init.lua file with this code:
if type(unified_inventory) == "table" and type(unified_inventory.registered_categories) == "table" then
if not unified_inventory.registered_categories["automation"] then
unified_inventory.register_category("automation", {
symbol = "pipeworks:lua_tube000000",
label = "Automation components"
})
end
unified_inventory.add_category_items("automation", pipeworks.ui_cat_tube_list)
end
It fixes the problem. Thought you may have a problem with using this code as it is AI generated. I have confirmed that it does work thought.
Here's your problem, xbows
is replacing the unified_inventory
global, along with a bunch of other globals: https://bitbucket.org/minetest_gamers/x_bows/src/cc5afc5bd754c609db797338ff96939ea6014031/init.lua?at=master#lines-24
Oh, that's what was casing it. So, I assume that this fix I suggested will not be used?
Although the cause should be fixed in xbows
, I've added a fix to prevent similar problems, which should work to fix the error: 7c74d0b
Good to know. Do you need it tested before you release it to the content database?
No, automatic releases are enabled, so it should update within a day.
Hi, this was also addressed in x_bows mod here https://bitbucket.org/minetest_gamers/x_bows/commits/ddf690bcd304ea7e6c672060a809a164984462db and should be working on the latest x_bows version
Good to know that this has been fixed now.
@JurajVajdaSakel
This isn't a good fix since mods won't check if sub tables/variables exist. Why don't you just use local variables?
got ya, addressed here https://bitbucket.org/minetest_gamers/x_bows/commits/bb5815f4df6ea2cc2885a2202a02191cdb167c5c
the whole thing there is only for setting types for lua diagnostics and its not really needed for the functionality of the code, so will get rid of it