travis: attempt downgrading luacov to 0.9.1 to fix line stats
[luajson.git] / tests / hook_require.lua
blob9586a4be9f22c2d01c5abb8f92bdd10b3abb0eed
1 local os = require("os")
2 local old_require = require
3 if os.getenv('LUA_OLD_INIT') then
4 local loadstring = loadstring or load
5 assert(loadstring(os.getenv('LUA_OLD_INIT')))()
6 else
7 require("luarocks.require")
8 end
9 local luarocks_require = require
11 function require(module, ...)
12 if module == "json" or module:match("^json%.") then
13 return old_require(module, ...)
14 end
15 return luarocks_require(module, ...)
16 end