A new closure for the variable x is created every time addto is called, so that each new anonymous function returned will always access its own x parameter. The closure is managed by Lua's garbage collector, just like any other object
ปิดใหม่สำหรับตัวแปร x จะถูกสร้างขึ้นทุกครั้งที่เพิ่มเพื่อเรียกว่าเพื่อให้แต่ละฟังก์ชั่นใหม่ที่ไม่ระบุชื่อกลับมักจะเข้าถึงพารามิเตอร์ x ของตัวเอง ปิดการจัดการโดยการเก็บขยะของ Lua เช่นเดียวกับวัตถุอื่น ๆ