When I call require 'name' in Lua, the name can be either a preloaded module name or a file that exists in a current working directory.
I have the following two questions:
A. I would like to know if it's possible to find out whether a preloaded module or a file will be required right before it will be required.
B. And if it's a file, I want to modify the script which will be required (by prepending/appending some code on top of existing one) and then require the modified script finally.
Are A and B both possible?
P.S.: I'm using Lua with C++.
require 'name'is the same asrequire('name'). In other words, it just calls whatever function value that the require variable refers to at the time the statement is executed. - Tom Blodget