[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Overriding the default 'require' in libLua (offer)
- From: Reuben Thomas <rrt@...>
- Date: Wed, 4 Jan 2012 17:55:16 +0000
There's no obvious reason to patch require in C; why not patch it in
Lua? Write your own require which calls the original require, and, if
it fails, does its own thing, loading a built-in string or whatever:
local old_require = require
function require (module)
local ok, m = pcall (old_require, module)
if ok then return m end
... -- try getting module from internal strings
end