Software / code / prosody
Comparison
util/array.lua @ 6417:060b63a27e9b
util.array: Add type() local
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 17 Sep 2014 14:50:44 +0200 |
| parent | 5857:8613888d0f9e |
| child | 6777:5de6b93d0190 |
comparison
equal
deleted
inserted
replaced
| 6416:9af742bb45b2 | 6417:060b63a27e9b |
|---|---|
| 12 local setmetatable = setmetatable; | 12 local setmetatable = setmetatable; |
| 13 local math_random = math.random; | 13 local math_random = math.random; |
| 14 local math_floor = math.floor; | 14 local math_floor = math.floor; |
| 15 local pairs, ipairs = pairs, ipairs; | 15 local pairs, ipairs = pairs, ipairs; |
| 16 local tostring = tostring; | 16 local tostring = tostring; |
| 17 local type = type; | |
| 17 | 18 |
| 18 local array = {}; | 19 local array = {}; |
| 19 local array_base = {}; | 20 local array_base = {}; |
| 20 local array_methods = {}; | 21 local array_methods = {}; |
| 21 local array_mt = { __index = array_methods, __tostring = function (array) return "{"..array:concat(", ").."}"; end }; | 22 local array_mt = { __index = array_methods, __tostring = function (array) return "{"..array:concat(", ").."}"; end }; |