dynamically typed vars:

basic types: nil, boolean, number, string, function, userdata, thread & table.

where nil has only one value, is mainly to differ from other types. absense of useful info

bool: false & true. so false & nil are both make a conditional false

number: int & floating point, 2 subtypes, rules to when to use which. also converting automatically, standard lua use 64-bit num. but can re-compile lua to use 32bit. (see luaconf.h

string: immutable sequence of bytes, containing all info in 8-bit value. encoding-agnostic (nice !

calling functions written in lua/c.

userdata: store any c data. raw memory. 2 kinds of userdata: full userdata: object; light userdata: pointer value. this type of data has no predefined ops, only to assign or identity test. It cannot be created or modifiied in lua. only through C api. guarentees the integrity. But using metatables, user can define ops for full userdata.

thread: represents independent threads of execution and used to implement coroutines. its not same as os's threads... coroutines are supported on all systems. even on no thread systems..

table: assoc. arrays. map? yes. with tables, arrays can be indexed through values other than numbers, but not nil or NaN. where NaN is actually number typed and to represent INF. but the key value can be anything except nil.. pathetic.. and conversely.. very odd.. any key not belonging to a table has an associated value nil. a.name is equal to a["name"]. -- syntax sugar

sequence

concept: equal without metamethods.. a.i, a.j refer to the same obj iff. i, j EWM. however, a.2 and a.2.0 refer to the same obj.. because float value which is actually a int will be automatically convert to the int.. so a.2.0 is actually a.2 .. table fields can be of any type.. including functions, tables can carry methods

tables, functions, threads, full userdata values are objs and refer to the address where locates. functions manipulate these refs only return the refer to these values, not modifying

function: type(), this returns a string describing the type of value..

special thing in table is the metatable, its inside the original table, besides the key and value, as another table. __index, __newindex, __call, __tostring. Where __index influence the behavior when referencing data not inside the main table, __newindex influences assignments of the keys, __call influences behavior when using tablename as methods, like table(), __tostring influences when print(table).. behavior.

lua: Learning Official Doc notes的更多相关文章

  1. Machine Learning Algorithms Study Notes(3)--Learning Theory

    Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...

  2. Machine Learning Algorithms Study Notes(2)--Supervised Learning

    Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...

  3. Machine Learning Algorithms Study Notes(1)--Introduction

    Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 目 录 1    Introduction    1 1.1    ...

  4. Machine Learning Algorithms Study Notes(6)—遗忘的数学知识

    机器学习中遗忘的数学知识 最大似然估计( Maximum likelihood ) 最大似然估计,也称为最大概似估计,是一种统计方法,它用来求一个样本集的相关概率密度函数的参数.这个方法最早是遗传学家 ...

  5. Machine Learning Algorithms Study Notes(5)—Reinforcement Learning

    Reinforcement Learning 对于控制决策问题的解决思路:设计一个回报函数(reward function),如果learning agent(如上面的四足机器人.象棋AI程序)在决定 ...

  6. Machine Learning Algorithms Study Notes(4)—无监督学习(unsupervised learning)

    1    Unsupervised Learning 1.1    k-means clustering algorithm 1.1.1    算法思想 1.1.2    k-means的不足之处 1 ...

  7. Deep Learning Workbench Installation Notes

    1. ROS Indigo (30 min) Just flow ROSWiki: http://wiki.ros.org/indigo/Installation/Ubuntu NOW simply ...

  8. <YaRN><Official doc><RM REST API's>

    Overview ... YARN Architecture The fundamental idea of YARN is to split up the functionalities of re ...

  9. learning ext2 filesystem notes

    reference:  http://e2fsprogs.sourceforge.net/ext2intro.html reference: http://www.nongnu.org/ext2-do ...

随机推荐

  1. wpf 遍历listview 时 传入指定类型 得到指定类型控件info

    private ChildType FindVisualChild<ChildType>(DependencyObject obj) where ChildType : Dependenc ...

  2. maven发布本地包,eclipse-maven集成tomcat7热部署项目

    国内maven 库 :http://maven.aliyun.com/nexus/content/groups/public/ maven安装不在中央仓库的jar包: mvn install:inst ...

  3. 三大框架之hibernate

    在DB Browser视图里新建一个数据库连接 Connection URL可填  jdbc:oracle:thin:@localhost:1521:orcl 或  jdbc:oracle:thin: ...

  4. JavaFx的一些总结

     JavaFX的一些总结:1.场景scene.布局layout.控件control是javaFX的基本组成部分.控件可以放到布局中,布局可以放到布局中,也可以放到场景中,这里要注意,场景里只能放一个布 ...

  5. 动态调用WCF

    最近在做的一个项目中需要动态调用WCF地址,因为有很多终端服务器,而每台终端服务器上都部署一个WCF服务,中央服务器需要不定时调用其中某个或者多个WCF服务执行相关操作,因此添加引用及配置文件配置的方 ...

  6. console.log 加样式

    console.log("%c%s", "color: black; font-size: 18px;", "test")

  7. 把Excel工作簿的每个工作表提取出来保存为新工作簿

    平台:MS office 2010 任务:有个excel工作簿,其中有上百个工作表,要求把每一个工作表全部保存为新工作簿,如果一个一个复制出来太傻了,可以用excel自带的VB解决. 方法:打开工作簿 ...

  8. easyUI的treegrid列表添加查询

    一些数据使用treegrid显示,添加筛选条件, 首先创建treegrid列表 var tree = $("#TreeGrid").treegrid({ url:"cha ...

  9. Jquery - UI - Dialog(转)

    jQuery UI Dialog常用的参数有: 1.autoOpen:默认true,即dialog方法创建就显示对话框 2.buttons:默认无,用于设置显示的按钮,可以是JSON和Array形式: ...

  10. shell中$(( )) 与 $( ) 还有${ }的区别

    http://blog.chinaunix.net/uid-14351756-id-2820651.html $( ) 与 ` ` (反引号)在 bash shell 中,$( ) 与 ` ` (反引 ...