# 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
#
# cd ..
#
# ls
hello.lua sec.lua
#
# lua hello.lua
Hello World!
#
# cat hello.lua
print("Hello World!")
#
# 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))
#
# lua sec.lua
enter a num
1
1
参考中文手册:http://www.codingnow.com/2000/download/lua_manual.html
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
#
# cd ..
#
# ls
hello.lua sec.lua
#
# lua hello.lua
Hello World!
#
# cat hello.lua
print("Hello World!")
#
# 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))
#
# lua sec.lua
enter a num
1
1
参考中文手册:http://www.codingnow.com/2000/download/lua_manual.html
本文介绍如何安装Lua编程环境,并通过简单的示例展示了Lua的基本语法和功能,包括Hello World程序、阶乘计算等。同时提供中文手册链接供深入学习。
2194

被折叠的 条评论
为什么被折叠?



