lua-users home
lua-l archive

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


On Wed, Jan 21, 2009 at 2:51 PM, František Fuka <fuka@fuxoft.cz> 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
test_function:

% lua
Lua 5.1.2  Copyright (C) 1994-2007 Lua.org, PUC-Rio
> require "foo"
> = debug.getinfo(should_be_foo.test_function).source
@./foo.lua
>
~/w/doc/notes/burndown % cat foo.lua

module "should_be_foo"

function test_function() end


Will that help?

Cheers,
Sam

-- 
Ars longa, vita brevis, occasio praeceps, experimentum periculosum,
iudicium difficile.