lua-users home
lua-l archive

Re: _PACKAGE in a nested module

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


Hi,
Matthew M. Burke wrote:
> Similarly, if you define a module, peanut.butter.sandwich, and then 
> print(peanut.butter.sandwich._PACKAGE) you get "peanut.butter.".
> 
> Is that the intended behavior?
Yes, I guess so. Because then you can
 require(_PACKAGE.."jar")
inside the module to get a sibling module, without checking
whether you need to add an intermediate dot or not (_PACKAGE
is "" for the toplevel).
Bye,
 Mike

AltStyle によって変換されたページ (->オリジナル) /