[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Is there a similar way to do if __name__=='__main__' as in python ?
- From: Bret Victor <bret@...>
- Date: Thu, 8 Feb 2007 07:14:29 +0000 (UTC)
My apologies; I forgot that we're all supposed to pay attention to
the return value of "require" these days. Here's a replacement for
my replacement:
local oldRequire = require
function require (...)
local wasInsideRequire = isInsideRequire
isInsideRequire = true
local t = oldRequire(...)
isInsideRequire = wasInsideRequire
return t
end