![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
lua
Gitar520
这个作者很懒,什么都没留下…
展开
-
lua闭包理解实例
function f1() local i = 1000 print("f1,i="..i) function f2() i = i + 1 print("f2,i="..i) function f3() i = i + 1 print("f3,i="..i) end f3() end f2() enda = f1a()a2 = f2a原创 2015-09-11 10:37:21 · 754 阅读 · 0 评论 -
lua5.2.3源码阅读笔记
今天研究了三块语句:1、if i > 0 then i = 300elseif i == 0 then i = 100else i = 0end指令: 1 [1] GETTABUP 0 0 -1 ; _ENV "i" 2 [1] LT 0 -2 0 ; 0 - 3原创 2015-09-14 18:03:20 · 740 阅读 · 0 评论 -
对lua #(取长度)操作符的理解
本文只讨论lua #取表长度。官方解释:3.4.6 – The Length OperatorThe length operator is denoted by the unary prefix operator #. The length of a string is its number of bytes (that is, the usual meaning of s原创 2015-09-18 14:44:07 · 3252 阅读 · 0 评论 -
lua5.3.5 gc源码分析笔记
GC是分步执行的,先来思考几个问题: 1、什么时候触发执行? Lua是用新增使用内存量达到一定数字时触发GC执行 2、这个新增使用内存量是怎么定的? Lua使用GCdebt变量来预设下次触发完整GC时机和触发下次单步GC时机 (时机:新使用内存增量时间间隔) 3、每次单步执行执行多久? ...原创 2018-11-15 16:08:45 · 1285 阅读 · 0 评论