Re: Confirmation for a potential case that causes an infinite loop
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Confirmation for a potential case that causes an infinite loop
- From: "Pierre Chapuis" <lua@...>
- Date: 2023年5月02日 09:17:31 +0200
x[1] is {} which, evaluated as a boolean, is true in Lua. The only false objects are `false` and `nil`, unlike other languages such as Python.
On Sun, Apr 30, 2023, at 12:56, Heqing HUANG wrote:
However, since x[1] is empty, should it be false and directly terminate the loop?
The main loop below never changes the value of x[1] and never creates
garbage (numbers are not objects).
while x[1] do -- repeat until GC
local a = A -- create garbage
A = A+1
end