lua-users home
lua-l archive

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



On Feb 02, 2005, at 12:00, David Burgess wrote:

methinks it goes away with 5.1

I see. I'm using lua-5.1-work4.

Still, even in 5.1, how does one find out about the physical location of a package?

Right now, I'm using the, er, debug library:

thisClass.className = function( aClass )
        if aClass ~= nil then
                local someInfo = debug.getinfo( aClass[ "new" ], "S" )
                local aSource = someInfo.source
                local anIndex = string.find( aSource, "/" )

                if anIndex ~= nil then
aSource = string.sub( aSource, anIndex + 1, string.len( aSource ) - 4 )

                        return aSource
                end
        end

        return nil
end

But there must be a more straightforward way, no?

As an aside, how does one find out the OS file separator (e.g. '/') from Lua itself?