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 ...
随机推荐
- HttpRequestMessage
mvc4中的WEBAPI,发现接收参数不是很方便,跟传统的request.querystring和request.form有很大区别,在网上搜了一大圈,各种方案都有,但不是太详细,于是跟踪Action ...
- emguCv3.x 实现字符分割,轮廓检测
/// <summary> /// 获取区域 /// </summary> /// <param name="bitmap"></para ...
- <poj - 3268> Silver Cow Party 牛のpart 最短路径问题
本题链接 : http://poj.org/problem?id=3268 题目大意:牛们要去聚会,输入N = 顶点数(牛场):M = 边(路)的数目: X = 终点 (聚会点).问题:求来回时间的最 ...
- 如何在 Linux 中找出最近或今天被修改的文件
1. 使用 ls 命令,只列出你的 home 文件夹中今天的文件. ls -al --time-style=+%D | grep `date +%D` 其中: -a- 列出所有文件,包括隐藏文件 -l ...
- javaMail邮件发送的简单实现
package com.test.mail; import java.util.Properties; import javax.mail.Message; import javax.mail.Ses ...
- 关于jq的load不用回调获取其中dom元素方法
jq的load方法如果要操作其中的dom元素,需要使用回调,等其加载完了再进行dom元素的获取,今天看我们项目组长写的一段代码,发现不用回调也能获取到其中的元素. 具体是这样写的: <scrip ...
- innodb更改行格式,系统盘占用急剧升高
#大表引擎修改后,数据量较myisam引擎表大很多,对存储的行格式修改后,数据量减小. #备库修改时,由于服务器时间较早,系统盘20G,突然收到/磁盘空间占比89%的报警,立即将修改中断,恢复正常 # ...
- aop代理方式引起的spring注入bean(实现类)与获取bean(实现类)出错
描述: 现象一 :A 为 接口,AImpl 为 A 的实现类,且 AImpl 受 aop 扫描,且 aop 无特殊配置 此时若:Spring 中 注入 AImpl 类型的bean,获取一样 ...
- 301跳转:IIS服务器网站整站301永久重定向设置方法(阿里云)
欢迎来到重庆SEO俱乐部:搜索引擎优化学习交流QQ群224306761. 承接:seo优化.网站建设.论坛搭建.博客制作.全网营销 博主可接:百度百家.今日头条.一点资讯等软文发布,有需要请联系PE! ...
- linux重要目录说明
1 home :root用户的home 目录是root,普通用户的home 目录是/home,users/(不要随便使用root权限,小白容易改错东西哒) 2 bin:常用可执行文件:/bin./us ...