Software / code / prosody
Comparison
util/set.lua @ 8522:073e517a1487
util.set: Add a __name field to metatable
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Fri, 16 Feb 2018 08:23:26 +0100 |
| parent | 6777:5de6b93d0190 |
| child | 8555:4f0f5b49bb03 |
comparison
equal
deleted
inserted
replaced
| 8521:6f5ce0f09f40 | 8522:073e517a1487 |
|---|---|
| 10 ipairs, pairs, setmetatable, next, tostring; | 10 ipairs, pairs, setmetatable, next, tostring; |
| 11 local t_concat = table.concat; | 11 local t_concat = table.concat; |
| 12 | 12 |
| 13 local _ENV = nil; | 13 local _ENV = nil; |
| 14 | 14 |
| 15 local set_mt = {}; | 15 local set_mt = { __name = "set" }; |
| 16 function set_mt.__call(set, _, k) | 16 function set_mt.__call(set, _, k) |
| 17 return next(set._items, k); | 17 return next(set._items, k); |
| 18 end | 18 end |
| 19 | 19 |
| 20 local items_mt = {}; | 20 local items_mt = {}; |