lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


> Apart from the joke, I did use # on table with holes (on purpose), and love its well-specified behavior !
> Indeed, I have an array of jobs that have unique ids. I start the unique ids at 1. I allow to reuse ids once the jobs have completed. Instead of maintaining a variable in order to compute the next available unique id that can be used, I simply use # on the table. All jobs are stored in 't[id] = job' manner. So I know that I'll have a free id with #t+1.

I sometimes rely on this useful behavior too. Fortunately, it is not
"undefined behavior" as some say. :-)

Alexander.