Comparison

tests/test.lua @ 7063:bc1b375f379e

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Fri, 08 Jan 2016 16:21:05 +0100
parent 7062:90e8bbfbaabd
child 7072:3121054e665f
comparison
equal deleted inserted replaced
7048:b58fd349ddfe 7063:bc1b375f379e
138 print("WARNING: ", "Failed to load module: "..unitname, err); 138 print("WARNING: ", "Failed to load module: "..unitname, err);
139 return; 139 return;
140 end 140 end
141 141
142 local oldmodule, old_M = _fakeG.module, _fakeG._M; 142 local oldmodule, old_M = _fakeG.module, _fakeG._M;
143 _fakeG.module = function () _M = unit end 143 _fakeG.module = function ()
144 setmetatable(unit, nil);
145 unit._M = unit;
146 end
144 setfenv(chunk, unit); 147 setfenv(chunk, unit);
145 local success, ret = pcall(chunk); 148 local success, err = pcall(chunk);
146 _fakeG.module, _fakeG._M = oldmodule, old_M; 149 _fakeG.module, _fakeG._M = oldmodule, old_M;
147 if not success then 150 if not success then
148 print("WARNING: ", "Failed to initialise module: "..unitname, err); 151 print("WARNING: ", "Failed to initialise module: "..unitname, err);
149 return; 152 return;
150 end 153 end