Comparison

mod_storage_appendmap/mod_storage_appendmap.lua @ 2430:a2625a36c092

mod_storage_appendmap: Fix pattern meant to match valid Lua Names so such are escaped correctly
author Kim Alvefur <zash@zash.se>
date Mon, 02 Jan 2017 21:03:56 +0100
parent 2205:98354fbea63c
child 2431:623e23190c3e
comparison
equal deleted inserted replaced
2429:0b3c7b03cb90 2430:a2625a36c092
34 if _VERSION == "Lua 5.1" then 34 if _VERSION == "Lua 5.1" then
35 assert(keyvalues._ENV == nil, "'_ENV' is a restricted key"); 35 assert(keyvalues._ENV == nil, "'_ENV' is a restricted key");
36 end 36 end
37 for key, value in pairs(keyvalues) do 37 for key, value in pairs(keyvalues) do
38 module:log("debug", "user %s sets %q to %s", user, key, tostring(value)) 38 module:log("debug", "user %s sets %q to %s", user, key, tostring(value))
39 if type(key) ~= "string" or not key:find("^[%w_][%w%d_]*$") or key == "_ENV" then 39 if type(key) ~= "string" or not key:find("^[%a_][%w_]*$") or key == "_ENV" then
40 key = "_ENV[" .. dump(key) .. "]"; 40 key = "_ENV[" .. dump(key) .. "]";
41 end 41 end
42 table.insert(keys, key); 42 table.insert(keys, key);
43 if value == self.remove then 43 if value == self.remove then
44 table.insert(values, "nil") 44 table.insert(values, "nil")