[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: FInding the real name of a module
- From: Sam Roberts <vieuxtech@...>
- Date: Wed, 21 Jan 2009 15:37:20 -0800
On Wed, Jan 21, 2009 at 2:51 PM, František Fuka <email@example.com> wrote:
> Another possibility was to simply "require" all the modules and then iterate
> through the whole package.loaded table, finding all tables which have item
> with key "test_function" whose value is function (I know other modules don't
> contain this function). But this also doesn't work because the order is
> significant. I have to call the test_function() functions in exactly the
> same order their filenames are present in the original array.
If you do that, and call debug.getinfo() on each of the test_function
functions, you might be able to get the source file name of
Lua 5.1.2 Copyright (C) 1994-2007 Lua.org, PUC-Rio
> require "foo"
> = debug.getinfo(should_be_foo.test_function).source
~/w/doc/notes/burndown % cat foo.lua
function test_function() end
Will that help?
Ars longa, vita brevis, occasio praeceps, experimentum periculosum,