Mercurial Hosting > luan
comparison http/src/luan/modules/http/Http.luan @ 509:e3b0846dc2ef
throw exception for invalid indexes of string, binary, or java
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 22 May 2015 02:02:49 -0600 |
parents | 9218f9cf45d3 |
children | aa17ad66a370 |
comparison
equal
deleted
inserted
replaced
508:9218f9cf45d3 | 509:e3b0846dc2ef |
---|---|
14 | 14 |
15 local singular_metatable = {} | 15 local singular_metatable = {} |
16 | 16 |
17 function singular_metatable.__index(table,key) | 17 function singular_metatable.__index(table,key) |
18 local list = table.__plural[key] | 18 local list = table.__plural[key] |
19 return list and (list[1] or error("invalid value "..list.." for "..key)) | 19 return list and list[1] |
20 end | 20 end |
21 | 21 |
22 function singular_metatable.__new_index(table,key,value) | 22 function singular_metatable.__new_index(table,key,value) |
23 table.__plural[key] = value and {value} | 23 table.__plural[key] = value and {value} |
24 end | 24 end |