[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [Newbie] Including a lua file from another lua file (problems with paths)
- From: Peter Cawley <lua@...>
- Date: Thu, 16 Jul 2009 02:13:22 +0100
On Thu, Jul 16, 2009 at 2:03 AM, Antoine
Bruguier<Antoine.Bruguier@brion.com> wrote:
> A workaround would be to get the current's file path and concatenate the strings, but I haven't found a way to do that either.
Given the file "Lua\libs\dir.lua":
local path = debug.getinfo(1,"S").source:match("@(.*"..package.config:sub(1,1)..")")
print(path)
Then the following:
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio
> dofile [[Lua\libs\dir.lua]]
Lua\libs\
> require "Lua.libs.dir"
.\Lua\libs\