Comparison

core/modulemanager.lua @ 7162:d0b64f1e4f5d

loggingmanager,modulemanager,moduleapi: Localize unpack compatible with Lua 5.2+
author Kim Alvefur <zash@zash.se>
date Thu, 18 Feb 2016 14:57:04 +0100
parent 6779:6236668da30a
child 7163:eadbf19d0de0
comparison
equal deleted inserted replaced
7160:5c1ee8c06235 7162:d0b64f1e4f5d
21 local xpcall = xpcall; 21 local xpcall = xpcall;
22 local setmetatable, rawget = setmetatable, rawget; 22 local setmetatable, rawget = setmetatable, rawget;
23 local ipairs, pairs, type, tostring, t_insert = ipairs, pairs, type, tostring, table.insert; 23 local ipairs, pairs, type, tostring, t_insert = ipairs, pairs, type, tostring, table.insert;
24 24
25 local debug_traceback = debug.traceback; 25 local debug_traceback = debug.traceback;
26 local unpack, select = unpack, select; 26 local select = select;
27 local unpack = table.unpack or unpack;
27 local pcall = function(f, ...) 28 local pcall = function(f, ...)
28 local n = select("#", ...); 29 local n = select("#", ...);
29 local params = {...}; 30 local params = {...};
30 return xpcall(function() return f(unpack(params, 1, n)) end, function(e) return tostring(e).."\n"..debug_traceback(); end); 31 return xpcall(function() return f(unpack(params, 1, n)) end, function(e) return tostring(e).."\n"..debug_traceback(); end);
31 end 32 end