Skip to content
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

loadstring or load can cause import errors #50

Open
LecrisUT opened this issue Oct 6, 2023 · 0 comments
Open

loadstring or load can cause import errors #50

LecrisUT opened this issue Oct 6, 2023 · 0 comments

Comments

@LecrisUT
Copy link

LecrisUT commented Oct 6, 2023

I was trying to run a code from lmod which imported this pacakge's json module by default. However, probably because of the use of strict, the import fails to run:

/usr/bin/lua: /usr/share/lua/5.4/json/encode/output.lua:8: variable 'loadstring' is not declared
stack traceback:
        [C]: in function 'error'
        ./libexec/../tools/strict.lua:36: in metamethod 'index'
        /usr/share/lua/5.4/json/encode/output.lua:8: in main chunk
        [C]: in function 'require'
        /usr/share/lua/5.4/json/encode.lua:12: in main chunk
        [C]: in function 'require'
        /usr/share/lua/5.4/json.lua:6: in main chunk
        [C]: in function 'require'
        ./libexec/spider:402: in local 'func'
        ./libexec/spider:494: in function 'main'
        ./libexec/spider:842: in main chunk
        [C]: in ?

lmod seems to use a syntax like:

local load       = (_VERSION == "Lua 5.1") and loadstring or load
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant