lua: Learning Official Doc notes
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的更多相关文章
- Machine Learning Algorithms Study Notes(3)--Learning Theory
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...
- Machine Learning Algorithms Study Notes(2)--Supervised Learning
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 本系列文章是Andrew Ng 在斯坦福的机器学习课程 CS 22 ...
- Machine Learning Algorithms Study Notes(1)--Introduction
Machine Learning Algorithms Study Notes 高雪松 @雪松Cedro Microsoft MVP 目 录 1 Introduction 1 1.1 ...
- Machine Learning Algorithms Study Notes(6)—遗忘的数学知识
机器学习中遗忘的数学知识 最大似然估计( Maximum likelihood ) 最大似然估计,也称为最大概似估计,是一种统计方法,它用来求一个样本集的相关概率密度函数的参数.这个方法最早是遗传学家 ...
- Machine Learning Algorithms Study Notes(5)—Reinforcement Learning
Reinforcement Learning 对于控制决策问题的解决思路:设计一个回报函数(reward function),如果learning agent(如上面的四足机器人.象棋AI程序)在决定 ...
- 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 ...
- Deep Learning Workbench Installation Notes
1. ROS Indigo (30 min) Just flow ROSWiki: http://wiki.ros.org/indigo/Installation/Ubuntu NOW simply ...
- <YaRN><Official doc><RM REST API's>
Overview ... YARN Architecture The fundamental idea of YARN is to split up the functionalities of re ...
- learning ext2 filesystem notes
reference: http://e2fsprogs.sourceforge.net/ext2intro.html reference: http://www.nongnu.org/ext2-do ...
随机推荐
- Java作用域
1. java访问控制修饰符 Java中,可以使用访问控制符来保护对类.变量.方法和构造方法的访问.Java支持4种不同的访问权限. 默认的,也称为 default,在同一包内可见,不使用任何修饰符. ...
- in_array 判断的一些见解
我个人见解in_array的判断是== 并不是=== 证明如下: $arr=(array_merge(range(1, 9),range('a', 'z'),range('A', 'Z')));$m ...
- 路由页面缓存开启 以及 keep-alive 给你埋下的坑
为什么要用keep-alive呢, 因为这个会缓存dom模板, 下次再回到这个页面, 就可以利用这个已经渲染好的dom结构了, 如果数据不一样, 也会启用 virtualDoM 进行diff更新, 这 ...
- win10十周年更新后cent os 虚拟机无法连接到xshell
1.在vmware中打开编辑-->虚拟网络编辑器-->还原默认设置
- Express ( MiddleWare/中间件 路由 在 Express 中使用模板引擎 常用API
A fast, un-opinionated, minimalist web framework for Node.js applications. In general, prefer simply ...
- Memcached内存存储
早就听说过Memcached独特的内存管理方式,写着篇文章的目的就是了解Memcached的内存管理,学习其源代码. 1.什么是Slab Allocator memcached默认情况下采用了名为Sl ...
- Angularjs directive全面解读(1.4.5)
说到Angularjs directive即指令,可以这么说Angularjs的灵魂就是指令,学会Angularjs指令那么你的Angularjs的武功就修炼了一半了,当然这只是鄙人的一点点独到见解, ...
- Win10安装安卓ADB驱动
Win10安装安装ADB驱动 Step1: 首先在黄色感叹号的ADB Interface 点右键菜单,选择“更新驱动程序软件”菜单. 在弹出“更新驱动程序软件”窗口中,选择下面一项“浏览计算机以查找驱 ...
- 2017-1-15-libubox analysis
2017-1-15-libubox analysis libubox utils.h utils.h 提供了一些简单的实用工具函数.比如大小端转换,位图操作,编译器属性的封装,连续内存申请函数call ...
- 注册表中LEGACY残留项的清理技巧
http://bbs.kafan.cn/thread-889517-1-1.html 注册表中LEGACY残留项的清理技巧 2.Windows Vista系统 Windows XP系统下的修改权限的方 ...