Drewol/unnamed-sdvx-clone

[Bug] Skin `.lua` file can't load library when using `gamedir` flag

DVN196 opened this issue · 0 comments

DVN196 commented

Describe the bug
When using gamedir flag and adding load path in lua files, the load path is relative to the game bin folder, not the gamedir

To Reproduce
Steps to reproduce the behavior:

  1. Use gamedir flag, add skin to skins folder
  2. Change skin
  3. There will be errors and warnings: the game cannot find lua file from skins/[skin-name]/... even if the file exist
  4. Copy the skin to bin/skins directory, the skin work normally.

Expected behavior
The load path should be relative to gamedir

Screenshots

Desktop (please complete the following information):

  • OS: Linux
  • GPU: RX6700
  • CPU: i5-12400
  • Version: [e.g. 0.4.0 or Git commit: 2019-12-18_c98c505] (found in log)

Additional context
I copy the files from skins/HeavenlyExpress-1.3.0/textures/_shared/scripts to the skin root folder to avoid the first error when loading skin.

Log file

[23:46:47][Warning] Lua error: .../skins/HeavenlyExpress-1.3.0/backgrounds/fallback/bg.lua:2: module 'commonShared' not found:
	no field package.preload['commonShared']
	no file '/usr/local/share/lua/5.3/commonShared.lua'
	no file '/usr/local/share/lua/5.3/commonShared/init.lua'
	no file '/usr/local/lib/lua/5.3/commonShared.lua'
	no file '/usr/local/lib/lua/5.3/commonShared/init.lua'
	no file './commonShared.lua'
	no file './commonShared/init.lua'
	no file 'skins/HeavenlyExpress-1.3.0/textures/_shared/scripts/commonShared.lua'
	no file 'skins/HeavenlyExpress-1.3.0/backgrounds/fallback/commonShared.lua'