wget http://www.lua.org/ftp/lua-5.3.0.tar.gz
tar xf lua-5.3.0.tar.gz
cd lua-5.3.0
make linux
sudo make linux install
test
lua -e "print('hello')"
hello.lua
print("hello lua.\n")
lua hello.lua
test
table.lua
a = {'a', 'b', 'c'}
n = table.getn(a)
print(n)
報錯
lua: table.lua:2: attempt to call a nil value (field 'getn')
stack traceback:
table.lua:2: in main chunk
[C]: in ?
原來table.getn在5.2這個版本中就被移除了 詳情
修改代碼
a = {'a', 'b', 'c'}
n = #a
print(n)
attempt to call a nil value (global 'setfenv')
setfenv is deprecated in Lua 5.2. Someone has created compatible functions for Lua5.1/5.2
setfenv在5.2版本中已經建議不在使用了
詳情
https://code.google.com/p/slt/issues/detail?id=1