Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
这样的事情会奏效吗?
local a = 2 for i=0, a do i = i + 1 a = a + 1 end
定义“工作”。
这将从 0 循环到 2,因为 Lua 只读取一次值。它只评估表达式一次,即初始时间。之后,它将它们存储在您无法找到或更改的局部变量中,并从那里进行测试。