Re:Lua 5.4.0 beta
by nomadluap on Thursday October 03, 2019 @08:23AM
(#21146147)
I'm looking through the new reference manual and there doesn't seem to be any mention of const variables, or any mention of how the new to-be-closed variables work. Do you just define the __close metamethod and lua takes care of the rest?
[ Parent
| on HN ]
I haven't tried them yet, but in the work reference manual, look at:
3.3.7 – Local Declarations
and
3.3.8 – To-be-closed Variables
I think the syntax use is: local x <const> = 5 local filename <const> = "/etc/fstab" local fh <close> = io.open(filename, "r")