I try to use JSON in Lua – I am completely new to Lua.
My code (test.lua)
local json = require ("json")
print "hello"
My install (Debian 12)
# luarocks install luajson
Installing https://luarocks.org/luajson-1.3.4-1.src.rock
luajson 1.3.4-1 depends on lua >= 5.1 (5.1-1 provided by VM)
luajson 1.3.4-1 depends on lpeg >= 0.8.1 (1.1.0-1 installed)
Do not use 'module' as a build type. Use 'builtin' instead.
luajson 1.3.4-1 is now installed in /usr/local (license: MIT/X11)
My output after
# lua test.lua
is this
lua: /usr/local/share/lua/5.1/json/decode/util.lua:97: attempt to call field 'version' (a string value)
stack traceback:
/usr/local/share/lua/5.1/json/decode/util.lua:97: in main chunk
[C]: in function 'require'
/usr/local/share/lua/5.1/json/decode.lua:12: in main chunk
[C]: in function 'require'
/usr/local/share/lua/5.1/json.lua:5: in main chunk
[C]: in function 'require'
awattar.lua:6: in main chunk
[C]: ?
Whats the problem here?