lua-users home
lua-l archive

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


Our package system equivalent (implemented before Lua 5.1 packages appeared
on the scene) gives all files in an NSBundle a shared environment and
includes in that environment a _BUNDLE variable pointing to the bundle.

A non-MacOS X specific solution might use directories instead of bundles and
include a _DIRECTORY variable in the environment.

(We also define a variable named _B that points to the environment while
leaving _G pointing to the shared global environment from which it
inherits.)

Mark

on 2/3/05 1:29 AM, PA at petite.abeille@gmail.com wrote:

> In a nutshell, this is what I'm planning to do:
> 
> "An NSBundle represents a location in the file system that groups code
> and resources that can be used in a program. NSBundles locate program
> resources, dynamically load executable code, and assist in
> localization."
> 
> http://developer.apple.com/documentation/Cocoa/Reference/Foundation/
> ObjC_classic/Classes/NSBundle.html
> 
>> Say I want to load a .jpg file that I bundle with my package, for
>> whaterver reason, can I use this method in 5.1 to do this?
> 
> Not out-of-the-box, but once you have the package location itself, it's
> breeze to do so.
> 
>> If not, then the problem still exists...
> 
> It would be indeed helpful if the magic 'require' function did record
> the original location of a package and made that information available
> in a standard fashion. In the meantime, debug.getinfo() it is :/