New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
print(package.path) != %LUA_PATH% ( 1.38.0 on Win10, 64bit ) #136
Comments
Add |
I need your debug plugin, as the VSC LuaUnit plugin depends on it... |
{
"version": "0.2.0",
"configurations": [
{
"type": "lua",
"request": "launch",
"name": "debug",
"program": "${workspaceFolder}/test.lua",
"path": "${env:LUA_PATH}
}
]
} |
Thanks, it works! But as using such launch.json files is not comfortable, please fix your code too, please. |
Nothing needs to be fixed, the design is just that. |
On Windows, with LuaDebug 1.40.0, With the JSON debugging configuration "Debug Current Script", this does not work. But if I change the debugger or change the file to be debugged, its most easy to start with a new launch.json file, and so I don´t like to fix it each time... |
You can modify the default value of path in the settings. |
THANKS alot, LUA_PATH problem solved. ( I beg your pardon, I am newbie to VSC, especially for configuration with extension settings & launch.json ) I just discovered your LUA_CPATH Extension settings :-), great. I am still confused, that the setting ${env:path} which is a total POWERSHELL-WINDOWS statement, also works for DebianLinux, if entered in the Extension Settings or in launch.json. Extension Settings, suggestion And please mention the Powershell-alike Syntax which is also valid for Linux, in the documentation. |
This is a feature of vscode. |
Cool ! |
When executing a LUA script.
print(package.path)
should print the contents of the environment variable LUA_PATH. On Win10pro, 64-bit, this should be - on my Win10 system, my choice for LUA_PATH -
./;.\?.lua;.\?\init.lua;C:\Users\Administrator\AppData\Roaming\luarocks\share\lua\5.3\?.lua;C:\Users\Administrator\AppData\Roaming\luarocks\share\lua\5.3\?\init.lua;
By this, the LUA script may process
require("module")
statements, both of local modules and of modules installed by LuaRocks.
This is true on my computer when running LUA scripts by POWERSHELL or CMD shell, or if I use some other VSC LUA debugger plugins.
( Some other VSC LUA debuggers add some extra string data to this string, by this a LUA script may find out that it is running in VSC and not in a shell.. ).
Indeed, VisualStudioCode with "lua-debug 1.38.0" prints the LUA style path to the current working directory, with "/?.lua" added.
Example:
C:\Users\Administrator\MyLuaWorkingDirectory/?.lua
, while executing the LUA script
C:\Users\Administrator\MyLuaWorkingDirectory/test.lua
ISSUE:
By this, VisualStudioCode with "lua-debug 1.38.0" fails to process
require("module")
statements, if the module was installed by LuaRocks.
Just by special trick to add
./;
to the LUA_PATH string,
I am able to process
require("module")
statements, if the module is a local module, situated in the LUA working directory where the LUA script is situated which "requires" a module. Please note that "/" and not "" and neither "\" is needed so that this trick works.
WORKAROUND, but no solution:
if I add the statement
package.path = package.path .. ";C:\\Users\\Administrator\\AppData\\Roaming\\luarocks\\share\\lua\\5.3\\?.lua"
to my code,
require("module")
statements are processed properly also for modules installed by LuaRocks.
FIX NEEDED:
Please implement that
print(package.path)
prints the contents of the environment variable LUA_PATH
The text was updated successfully, but these errors were encountered: