Current / Active module name

Is there a way to get the currently active module name?

e.g. if I am in screen1.lua, how can I get this information

I have tried

n = package.loaded.name
n = package.loaded.modname

I have run out of ideas.
Does anyone know this please??

cheers
[import]uid: 103163 topic_id: 18616 reply_id: 318616[/import]

its active right as you require it

what are you trying to accomplish? [import]uid: 16142 topic_id: 18616 reply_id: 71482[/import]

To get the various active modules loaded try this code:

for i,v in pairs(package.loaded) do  
 print(i)  
end  

If you are thinking about removing them from memory, I think this works:
_G[**module name**] = nil [import]uid: 94868 topic_id: 18616 reply_id: 71483[/import]

Hi
thx for replies.
Basically I have a module per screen in my app, and I have been manually passing module names between themselves for previous screen, next screen, destination screen etc. and was looking for a better way of doing it.

I will try the code you have posted and thx to you both for replies [import]uid: 103163 topic_id: 18616 reply_id: 71488[/import]

If you wanted to pass the module names you can use the _G table.

In your main.lua file:
_G[“yourVariableName”] = require(“modulefileName”)

then in your other lua files you can just access the module via _G[“yourVariableName”] or you might want to localize it in each file, and then use that variable throughout your code, like:

local yourVariableName = _G[“yourVariableName”] [import]uid: 94868 topic_id: 18616 reply_id: 71490[/import]

thx again! [import]uid: 103163 topic_id: 18616 reply_id: 71492[/import]