You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I've just started with lua-language-server, so excuse me if this is kind of RTFM.
I have some legacy Lua 4.0 code. You know: no modules, just .lua files loaded with "dofile".
When I have a e.g. modulefun function in mymodule.lua, which I load in main.lua with dofile("mymodule"), lua-server gives "Undefined global 'modulefun' on modulefun(param) function call (when in main.lua file in editor).
Kind of no surprise, as lua-language-server docs state clearly it supports Lua >=5, so I can imagine it handles "require" rather than "dofile".
BUT, I've noticed that if I add this to .luarc.json:
(where c:/mylualib/ is directory where my mymodule.lua is located) then, lua-language-server properly displays parameters hints on modulefun call, but still says "Undefiled global" for this function.
This proves language server knows SOMETHING about included file as it displays hints, but still considers functions from it "Undefined globals". Any recipe to have it working with Lua 4?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi. I've just started with lua-language-server, so excuse me if this is kind of RTFM.
I have some legacy Lua 4.0 code. You know: no modules, just .lua files loaded with "dofile".
When I have a e.g.
modulefun
function inmymodule.lua
, which I load inmain.lua
withdofile("mymodule")
, lua-server gives "Undefined global 'modulefun' on modulefun(param) function call (when inmain.lua
file in editor).Kind of no surprise, as lua-language-server docs state clearly it supports Lua >=5, so I can imagine it handles "require" rather than "dofile".
BUT, I've noticed that if I add this to .luarc.json:
(where
c:/mylualib/
is directory where mymymodule.lua
is located) then, lua-language-server properly displays parameters hints onmodulefun
call, but still says "Undefiled global" for this function.This proves language server knows SOMETHING about included file as it displays hints, but still considers functions from it "Undefined globals". Any recipe to have it working with Lua 4?
Beta Was this translation helpful? Give feedback.
All reactions