lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On 25/11/14 06:18 PM, Sean Conner wrote:
It was thus said that the Great Thiago L. once stated:
On 25/11/14 04:58 PM, Sean Conner wrote:
It was thus said that the Great Thiago L. once stated:
So I noticed I can monkeypatch package.loaded with a metatable. What's
this useful for?
   It's a regular table, and you can always add a metatable to a table?

   -spc (The same way you can add a metatable to _G ... )


require() respects it
   And?  You seem surprised for some reason.  You expected package.loaded to
be special somehow?  I'm not sure what you are getting at.

   -spc


I expected require() to use rawset()/rawget()... I actually like being able to monkeypatch it but meh IMO the manual isn't clear enough... (Side note: if I use metatables to make package.loaded[modname] nil, require still returns true, even tho it's supposed to return the final value)

--
Disclaimer: these emails are public and can be accessed from <TODO: get a non-DHCP IP and put it here>. If you do not agree with this, DO NOT REPLY.