追风男孩
2014-08-06 06:43:12 UTC
i meet some questions when i use your luajit:
the contents of the lua file "test1.lua" are follows:
require('package')
require('math')
require('socket')
print(_VERSION);
print ("just test")
print ("just test1")
print ("just test2")
print ("just test3")
num=1
num=num+1
print(num)
i used command lua on prompt line to run test1.lua is ok
F:\>lua test1.lua
Lua 5.1
just test
just test1
just test2
just test3
2
but when i used command luajit to run the same lua file "test1.lua" it's wrong and the wrong messages as follows:
F:\>luajit test1.lua
luajit: test1.lua:7: module 'socket' not found:
no field package.preload['socket']
no file './socket.lua'
no file '/usr/local/share/luajit-2.0.3/socket.lua'
no file '/usr/local/share/lua/5.1/socket.lua'
no file '/usr/local/share/lua/5.1/socket/init.lua'
no file './socket.so'
no file '/usr/local/lib/lua/5.1/socket.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
test1.lua:7: in main chunk
[C]: at 0x004021b0
the contents of the lua file "test1.lua" are follows:
require('package')
require('math')
require('socket')
print(_VERSION);
print ("just test")
print ("just test1")
print ("just test2")
print ("just test3")
num=1
num=num+1
print(num)
i used command lua on prompt line to run test1.lua is ok
F:\>lua test1.lua
Lua 5.1
just test
just test1
just test2
just test3
2
but when i used command luajit to run the same lua file "test1.lua" it's wrong and the wrong messages as follows:
F:\>luajit test1.lua
luajit: test1.lua:7: module 'socket' not found:
no field package.preload['socket']
no file './socket.lua'
no file '/usr/local/share/luajit-2.0.3/socket.lua'
no file '/usr/local/share/lua/5.1/socket.lua'
no file '/usr/local/share/lua/5.1/socket/init.lua'
no file './socket.so'
no file '/usr/local/lib/lua/5.1/socket.so'
no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
[C]: in function 'require'
test1.lua:7: in main chunk
[C]: at 0x004021b0