x = 10
io.write("Enter the name of the variable you want to be printed: ")
index = io.read()
f = loadstring("return " .. index)
print(f())
The above code gives this error when used in a terminal, but not when ran in zerobrane studio
main.lua:874: attempt to call a nil value (global 'loadstring')
stack traceback:
main.lua:874: in main chunk [C]: in ?
This is important because i am coding lua in emacs. how can i correct this problem? Need help.
Your terminal version of Lua is higher than Lua in ZeroBrane.
Lua 5.3 removed
loadstring
and it exists asload
now.