I'm trying to learn Lua, and the tutorial I'm following has the following code as a step:
print("Welcome to")
print("THE GAME")
I, having some prior experience programming, decided to take it a step further:
require "socket"
function sleep(sec)
socket.select(nil, nil, sec)
end
print("Welcome to.....")
sleep(1.25)
print("...")
sleep(1.25)
print("...")
sleep(1.25)
print("...")
sleep(1.25)
print("...")
sleep(1.25)
print("THE GAME")
And for some reason, this small addition immediately gave me an error:
dave@dave-[my laptop]:~/Code/Lua/Test$ lua main.lua
lua: error loading module 'socket.core' from file '/home/dave/torch/install/lib/lua/5.1/socket/core.so':
/home/dave/torch/install/lib/lua/5.1/socket/core.so: undefined symbol: lua_pcall
stack traceback:
[C]: in ?
[C]: in function 'require'
/home/dave/torch/install/share/lua/5.1/socket.lua:12: in main chunk
[C]: in function 'require'
main.lua:1: in main chunk
[C]: in ?
I'm not sure how I broke something this simple. Did I install Lua wrong? I'm running Lua 5.2.3 on Ubuntu 14.04.
lib/lua/5.1/socket/core.so
I'm running Lua 5.2.3
Well, there's your problem. Lua is not binary compatible with previous "minor" versions. So you cannot load a .so that was built for Lua 5.1 when you're executing in Lua 5.2.
Assuming the socket library has a 5.2 version, you need to upgrade to it. If you can't do that, then you need to downgrade to Lua 5.1.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.