-- 1.Hello world
print( "--------------1--------------")
print("Hello world"); -- 2. function define
function add(a,b)
return a + b
end print( "--------------2--------------")
print( "enter a number:" )
n = io.read("*number")
m = io.read("*number")
print( add(m,n) ) -- 3. lua 的数据类型
print( "--------------3--------------")
print(type("Hello world"))
print(type())
print(type(add))
print(type(false))
print(type(nil)) -- 4. 数字, 字符串操作
print( "--------------4--------------")
print( "" + + )
print( "" .. .. ) str = "Hello world"
print( "\"".. str .. "\" length: = " .. #str) -- 5. table 关联数组
print( "--------------5--------------")
tab1 = {}
tab1["day"] =
days = "days"
tab1[days] = tab1.day + print(tab1.day)
print(tab1.days) -- 用table来实现线性表
array = {};
for i = , do
array[i] = i.. " word"
end for i = , #array do
print(array[i])
end -- table大小
print ("the array size: " .. #array) --> the array size: 10 --6. 函数式编程
p = add
print( p(, )) --> function programming

lua 入门学习的更多相关文章

  1. [2017.02.07] Lua入门学习记录

    #!/home/auss/Projects/Qt/annotated/lua -- 这是第一次系统学习Lua语言 --[[ 参考资料: 1. [Lua简明教程](http://coolshell.cn ...

  2. Openresty最佳案例 | 第2篇:Lua入门

    转载请标明出处: http://blog.csdn.net/forezp/article/details/78616622 本文出自方志朋的博客 什么是lua Lua 是一种轻量小巧的脚本语言,用标准 ...

  3. Lua入门记录

    学习资料 Lua入门和Lua高阶章节 Lua中文文档 阅读笔记,只是记录了知识点和一些注意点,详细的看上面提供的学习资料链接 Lua 基础数据类型 nil(空) boolean(布尔) Lua 中 n ...

  4. vue入门学习(基础篇)

    vue入门学习总结: vue的一个组件包括三部分:template.style.script. vue的数据在data中定义使用. 数据渲染指令:v-text.v-html.{{}}. 隐藏未编译的标 ...

  5. Hadoop入门学习笔记---part4

    紧接着<Hadoop入门学习笔记---part3>中的继续了解如何用java在程序中操作HDFS. 众所周知,对文件的操作无非是创建,查看,下载,删除.下面我们就开始应用java程序进行操 ...

  6. Hadoop入门学习笔记---part3

    2015年元旦,好好学习,天天向上.良好的开端是成功的一半,任何学习都不能中断,只有坚持才会出结果.继续学习Hadoop.冰冻三尺,非一日之寒! 经过Hadoop的伪分布集群环境的搭建,基本对Hado ...

  7. PyQt4入门学习笔记(三)

    # PyQt4入门学习笔记(三) PyQt4内的布局 布局方式是我们控制我们的GUI页面内各个控件的排放位置的.我们可以通过两种基本方式来控制: 1.绝对位置 2.layout类 绝对位置 这种方式要 ...

  8. PyQt4入门学习笔记(一)

    PyQt4入门学习笔记(一) 一直没有找到什么好的pyqt4的教程,偶然在google上搜到一篇不错的入门文档,翻译过来,留以后再复习. 原始链接如下: http://zetcode.com/gui/ ...

  9. Hadoop入门学习笔记---part2

    在<Hadoop入门学习笔记---part1>中感觉自己虽然总结的比较详细,但是始终感觉有点凌乱.不够系统化,不够简洁.经过自己的推敲和总结,现在在此处概括性的总结一下,认为在准备搭建ha ...

随机推荐

  1. 使用Idhttp.get('') 造成假死(堵塞),请问线程idhttp怎么才能做到不出错?

    参考这个帖子 http://blog.csdn.net/chyoma/article/details/50839715

  2. Aquarium Filtration

    http://www.fishyou.com/aquarium-filtration.php Aquarium Filtration This section covers aquarium filt ...

  3. Runloop基础知识

    *:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...

  4. 创建线程方式-NSOperation

    *:first-child { margin-top: 0 !important; } body > *:last-child { margin-bottom: 0 !important; } ...

  5. ArchLinux KDE安装中文输入法

    From: http://www.linuxdiyf.com/viewarticle.php?id=53375 1.安装中文输入法#pacman -S scim-pinyin #拼音输入法#pacma ...

  6. 前端项目构建error

    Refusing to install webpack as a dependency of itself 原因:package.json中,"name": "webpa ...

  7. dedecms 打印出网站所有 文章标题和链接(URL)的方法

    {dede:arclist row="100000"} <li>[field:fulltitle/]***网站URL地址***[field:arcurl/]</l ...

  8. Inside The C++ Object Model - 03

    object Lessons 1.C++中布局以及存取时间上的的额外负担是由virtual引起的:virtual function.virtual base class.或是由于多继承引起的. 2.C ...

  9. 各种数据库分页sql

    1.oracle数据库分页 select * from (select a.*,rownum rc from 表名 where rownum<=endrow) a where a.rc>= ...

  10. SQL SELECT语句

    基本SQL SELECT语句   1.       下面的语句是否可以执行成功 select ename , job , sal as salary  from emp; 2.       下面的语句 ...