emc
New Coder
Hello, I got some lua script
But I need rewite it using absolut paths, my take:
Looks like package.path is updated correctly, but I dont know how use require to load file lfs.lua from ..\test\compile\ directory, result is like (by the way I'm using lupa python libarary:
Code:
package.path = "./Scripts/DCS-BIOS/test/compile/?.lua;" .. package.path
lfs = require("Scripts.DCS-BIOS.test.compile.lfs")
dofile([[Scripts/DCS-BIOS/BIOS.lua]])
Code:
print(package.path)
package.path = "C:\\\\Users\\\\mplichta\\\\Saved Games\\\\DCS-BIOS\\\\test\\\\compile\\\\?.lua;" .. package.path
print(package.path)
lfs = require("Users.mplichta.Saved Games.DCS-BIOS.test.compile.lfs")
...
Code:
.\?.lua;C:\Users\mplichta\AppData\Roaming\uv\python\cpython-3.13.0rc2-windows-x86_64-none\lua\?.lua;C:\Users\mplichta\AppData\Roaming\uv\python\cpython-3.13.0rc2-windows-x86_64-none\lua\?\init.lua;
C:\Users\mplichta\Saved Games\DCS-BIOS\test\compile\?.lua;.\?.lua;C:\Users\mplichta\AppData\Roaming\uv\python\cpython-3.13.0rc2-windows-x86_64-none\lua\?.lua;C:\Users\mplichta\AppData\Roaming\uv\python\cpython-3.13.0rc2-windows-x86_64-none\lua\?\init.lua;
Traceback (most recent call last):
File "C:\Users\mplichta\AppData\Roaming\JetBrains\PyCharm2024.2\scratches\scratch_21.py", line 22, in <module>
lua.execute(lua_script)
~~~~~~~~~~~^^^^^^^^^^^^
File "lupa\\luajit21.pyx", line 463, in lupa.luajit21.LuaRuntime.execute
File "lupa\\luajit21.pyx", line 1904, in lupa.luajit21.run_lua
File "lupa\\luajit21.pyx", line 1918, in lupa.luajit21.call_lua
File "lupa\\luajit21.pyx", line 1945, in lupa.luajit21.execute_lua_call
File "lupa\\luajit21.pyx", line 1826, in lupa.luajit21.raise_lua_error
lupa.luajit21.LuaError: [string "<python>"]:5: module 'Users.mplichta.Saved Games.DCS-BIOS.test.compile.lfs' not found:
no field package.preload['Users.mplichta.Saved Games.DCS-BIOS.test.compile.lfs']
no file 'C:\Users\mplichta\Saved Games\DCS-BIOS\test\compile\Users\mplichta\Saved Games\DCS-BIOS\test\compile\lfs.lua'
no file '.\Users\mplichta\Saved Games\DCS-BIOS\test\compile\lfs.lua'
no file 'C:\Users\mplichta\AppData\Roaming\uv\python\cpython-3.13.0rc2-windows-x86_64-none\lua\Users\mplichta\Saved Games\DCS-BIOS\test\compile\lfs.lua'
no file 'C:\Users\mplichta\AppData\Roaming\uv\python\cpython-3.13.0rc2-windows-x86_64-none\lua\Users\mplichta\Saved Games\DCS-BIOS\test\compile\lfs\init.lua'
no file '.\Users\mplichta\Saved Games\DCS-BIOS\test\compile\lfs.dll'
no file 'C:\Users\mplichta\AppData\Roaming\uv\python\cpython-3.13.0rc2-windows-x86_64-none\Users\mplichta\Saved Games\DCS-BIOS\test\compile\lfs.dll'
no file 'C:\Users\mplichta\AppData\Roaming\uv\python\cpython-3.13.0rc2-windows-x86_64-none\loadall.dll'
no file '.\Users.dll'
no file 'C:\Users\mplichta\AppData\Roaming\uv\python\cpython-3.13.0rc2-windows-x86_64-none\Users.dll'
no file 'C:\Users\mplichta\AppData\Roaming\uv\python\cpython-3.13.0rc2-windows-x86_64-none\loadall.dll'
stack traceback:
[string "<python>"]:5: in main chunk
[C]: in function 'require'