阅读更多
[root@server-X lua-5.2.2]# make
Please do 'make PLATFORM' where PLATFORM is one of these:
aix ansi bsd freebsd generic linux macosx mingw posix solaris
See doc/readme.html for complete instructions.
安装:make linux install
[root@server-X lua-5.2.2]#
[root@server-X lua-5.2.2]# cd ..
[root@server-X luaLearn]#
[root@server-X luaLearn]# ls
hello.lua sec.lua
[root@server-X luaLearn]#
[root@server-X luaLearn]# lua hello.lua
Hello World!
[root@server-X luaLearn]#
[root@server-X luaLearn]# cat hello.lua
print("Hello World!")
[root@server-X luaLearn]#
[root@server-X luaLearn]# cat sec.lua
function fact(n)
if n == 0 then
return 1
else
return n*fact(n-1)
end
end
print("enter a num")
a=io.read("*number")
print(fact(a))
[root@server-X luaLearn]#
[root@server-X luaLearn]# lua sec.lua
enter a num
1
1
参考中文手册:http://www.codingnow.com/2000/download/lua_manual.html