Typed Lua】的更多相关文章

https://the-ravi-programming-language.readthedocs.io/en/latest/ravi-overview.html https://github.com/andremm/typedlua https://github.com/teal-language/tl https://luarocks.org/…
弱表(weak table)是一个很有意思的东西,像C++/Java等语言是没有的.弱表的定义是:A weak table is a table whose elements are weak references,元素为弱引用的表就叫弱表.有弱引用那么也就有强引用,有引用那么也就有非引用.我们先要厘这些基本概念:变量.值.类型.对象. (1)变量与值:Lua是一个dynamically typed language,也就是说在Lua中,变量没有类型,它可以是任何东西,而值有类型,所以Lua中没…
function table.count(t) if type(t) ~= "table" then assert(false) return end for k, _ in pairs(t) do n = n + end return n end local t = { x1 = "hello", x2 = "world", [] = "x1111", } print(table.count(t)) t.x1 = nil c…
转自:http://foredoomed.org/blog/2013/12/07/integrate-c-with-lua/ 我们在用C写程序的时候,很多情况下需要用到List,Map等集合,但是C是不原生支持这些数据结构的.碰到这种情况的话,要么自己实现一套API,要么就用别人写好的现成的类库.但是大多数情况下现有类库的API使用起来非常不舒服,自己写呢又重复造轮子,那有没有其他的办法呢?答案是肯定的.我们可以用Lua这个嵌入式脚本语言与C搭配使用,来弥补C这个古老语言的很多先天性的不足. 0…
转载自:http://magicpanda.net/2010/10/lua%E6%9E%B6%E6%9E%84%E6%96%87%E6%A1%A3/ Lua架构文档(翻译) 十 102010 前段时间翻译了lua官方关于lua5架构设计的一份文档,现在分享给大家. 注意:所有版权都归lua官方所有,本人仅将其翻译为中文,以方便中文阅读者.翻译中出现任何错误导致的结果,本人不负任何责任. 如果有任何翻译错误,以及意见与建议,请email本人.邮件地址:ice_ok@163.com. 转载请注明原作…
lua命令: #enter shell lua #excute script file lua xxx.lua lua脚本: #!/usr/local/bin/lua 核心概念: As a extension language, Lua has no notion of  a 'Main’ program: it only works embedded in a host client, called the embedding program or simply the host. The h…
英文原版: http://www.lua.org/manual/5.1/ 中文版下面2个地址都有:一样的 manual.luaer.cn lua在线手册 lua参考手册Lua参考手册的中文翻译(云风翻译版本) 重要部分: 2.2 – Values and Types Lua is a dynamically typed language. This means that variables do not have types; only values do. There are no type…
弱表(weak table)是一个很有意思的东西,像C++/Java等语言是没有的.弱表的定义是:A weak table is a table whose elements are weak references,元素为弱引用的表就叫弱表.有弱引用那么也就有强引用,有引用那么也就有非引用.我们先要厘这些基本概念:变量.值.类型.对象. (1)变量与值:Lua是一个dynamically typed language,也就是说在Lua中,变量没有类型,它可以是任何东西,而值有类型,所以Lua中没…
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…
前面一篇文章中介绍了lua给下面代码生成最终的字节码的整个过程,这次我们来看看lua vm执行这些字节码的过程. foo = "bar" local a, b = "a", "b" foo = a 生成的字节码如下所示: 之前lua是在luaY_parser函数(入口)中完成了lua脚本的解析生成字节码的整个过程的,在生成了main func(过程见“lua解析赋值类型代码的过程“)后luaY_parser会返回一个Proto结构体指针tf,Pr…