justarandomgeek / vscode-factoriomod-debug

Factorio Mod Tool Kit
Other
122 stars 26 forks source link

attempt to perform bitwise operation on a nil value (local 'right') #145

Closed BurninSun closed 1 month ago

BurninSun commented 1 month ago

fmtk 2.0.0, vscode 1.94.2, lua3.11.1

fmtk switched to pre-release version. Restarted vscode multiple times.

Opening space exploration results in this error (full output log below):

[string "return function(left, right) return left & ri..."]:1: attempt to perform bitwise operation on a nil value (local 'right')
stack traceback:
    [string "return function(left, right) return left & ri..."]:1: in upvalue 'band'
    ...omod-debug/sumneko-3rd/factorio/factorio-plugin\util.lua:194: in function 'factorio-plugin.util.is_disabled'
    ...d-debug/sumneko-3rd/factorio/factorio-plugin\storage.lua:92: in function 'factorio-plugin.storage.replace'
    ...omgeek.factoriomod-debug\sumneko-3rd\factorio\plugin.lua:214: in function <...omgeek.factoriomod-debug\sumneko-3rd\factorio\plugin.lua:187>
    [C]: in function 'xpcall'
    script\plugin.lua:40: in function 'plugin.dispatch'
    script\files.lua:193: in upvalue 'pluginOnSetText'
    script\files.lua:264: in function 'files.setText'
    script\workspace\loading.lua:104: in function <script\workspace\loading.lua:80>

file_c%3A_Users_User_AppData_Roaming_Factorio_mods_space-exploration.log output.log

justarandomgeek commented 1 month ago

@JanSharp i know you're busy but i suspect you may be better able to make sense of this than i am - probably see also a5bcd08ddacab1740c6e4a838182a8f5768d3aeb, i probably broke something there

JanSharp commented 1 month ago

This looks impossible. The changes you've made in a5bcd08 look just fine, and in order for this error to happen util.module_flags.storage would have to be nil which can only happen if the util file didn't get updated while the other files did. Which also sounds impossible.

@BurninSun If you could navigate to ...omod-debug/sumneko-3rd/factorio/factorio-plugin\util.lua (you can find the full path in your vscode settings file - see the Lua.workspace.userThirdParty setting. Don't know if it'll be in your user or workspace settings.) And then in that util file navigate to line 151. It should say storage = 2, but if it's outdated it'll say global = 2.

BurninSun commented 1 month ago

Everything appears to be correct. Also reverted back and forth between release and pre-release with restarts in between to no effect. image

justarandomgeek commented 1 month ago

if you only did one restart after each version change, then it auto-updated the installed plugin on startup and luals may have loaded it during that (there is no way to control that timing, so it does that sometimes)

BurninSun commented 1 month ago

I've restarted it a few times at this point, still no luck. I can verify that switching release/pre-release versions deletes and recreates the factorio-plugin folder and that changes util.lua line 151 between global and storage. Also tried reverting release/pre-release version, restart extensions, wait for load, restart vs code 2x waiting for load, then switch versions. Still the same.

justarandomgeek commented 1 month ago

does 2.0.1 behave any better?

justarandomgeek commented 1 month ago

oh and what does the Factorio: Check Config command (from command pallate) say?

BurninSun commented 1 month ago

No luck on the 2.0.1 update.

Factorio: check config

2024-10-21 14:30:43.751 [info] Registering Version Selector...
2024-10-21 14:30:43.751 [info] Registering Debug Provider...
2024-10-21 14:30:43.752 [info] Registering Language Client...
2024-10-21 14:30:43.752 [info] Registering Mod Package Provider...
2024-10-21 14:30:43.752 [info] Registering Profile Renderer...
2024-10-21 14:30:43.752 [info] Registering Custom Editors...
2024-10-21 14:30:43.752 [info] Activate Complete
2024-10-21 14:30:43.752 [info] Active Factorio version: Steam (2.0.8)
2024-10-21 14:37:00.366 [info] FMTK 2.0.2
2024-10-21 14:37:00.366 [info] Registering Version Selector...
2024-10-21 14:37:00.366 [info] Registering Debug Provider...
2024-10-21 14:37:00.366 [info] Registering Language Client...
2024-10-21 14:37:00.366 [info] Registering Mod Package Provider...
2024-10-21 14:37:00.366 [info] Registering Profile Renderer...
2024-10-21 14:37:00.366 [info] Registering Custom Editors...
2024-10-21 14:37:00.366 [info] Activate Complete
2024-10-21 14:37:00.379 [info] Active Factorio version: Steam (2.0.8)
2024-10-21 14:37:28.574 [info] Check Config:
2024-10-21 14:37:28.579 [info] Active Factorio Version:
2024-10-21 14:37:28.623 [info] Binary: 2.0.8
2024-10-21 14:37:28.623 [info] Runtime JSON: 2.0.8
2024-10-21 14:37:28.664 [info] Library bundle found in c:\Users\User\AppData\Roaming\Code\User\workspaceStorage\4f50da658d62ca3489fe4766c001a1e9\justarandomgeek.factoriomod-debug, generated from Factorio 2.0.8 with FMTK 2.0.2
2024-10-21 14:37:28.694 [info] LuaLS 3.11.1 Activated
2024-10-21 14:37:28.694 [info] Lua.workspace.userThirdParty: workspace link OK (c:\Users\User\AppData\Roaming\Code\User\workspaceStorage\4f50da658d62ca3489fe4766c001a1e9\justarandomgeek.factoriomod-debug\sumneko-3rd)
2024-10-21 14:37:28.694 [info] Lua.workspace.checkThirdParty = ApplyInMemory
2024-10-21 14:37:28.695 [warning] Lua.workspace.library: /data link missing! (c:\Program Files (x86)\Steam\steamapps\common\Factorio\data)
2024-10-21 14:37:28.695 [warning] Lua.workspace.library: stale workspace link? (c:/Users/User/AppData/Roaming/Code/User/workspaceStorage/f0d4b59c65440d720cd534feddd1408e/justarandomgeek.factoriomod-debug/sumneko-3rd/factorio/library)
2024-10-21 14:37:28.695 [warning] Lua.runtime.plugin: wrong plugin? (c:/Users/User/AppData/Roaming/Code/User/workspaceStorage/f0d4b59c65440d720cd534feddd1408e/justarandomgeek.factoriomod-debug/sumneko-3rd/factorio/plugin.lua)
BurninSun commented 1 month ago

In the settings, changed references from f0d4b59c65440d720cd534feddd1408e (old version) to 4f50da658d62ca3489fe4766c001a1e9 (new version) which then complained about redundant libraries. Removed those listed as redundant and everything appears to be resolved.

justarandomgeek commented 1 month ago

with checkThirdParty=ApplyInMemory set, you should just delete the Lua.runtime.plugin and Lua.runtime.library settings that refer to the same tree as userThirdParty, it'll pick it up automatically and stay with updates in the future! (and i need to fix the /data link check, since i dont' link that anymore by default...)