Module to talk to parent ?

In objc you would create delegates. So lets say i have in my main.lua file, this

Local b = require “mymodule”

Local d = b.new()

Then

Local e = d.getfile(“dadada.txt”)
I would like the getfile function to trigger a function inside the main.lua if the file downloads or fails, two different functions.

Is it as simple as both files requiring on another? I hope i am making myself understandable. I want my module to call a function in its parent [import]uid: 61610 topic_id: 10756 reply_id: 310756[/import]

From my understanding of modules, they’re like children to a parent. Not many languages let the children dictate to the parent. There are a few ways around this, one is to use a Setter/Getter type style like Action Scripts or, to fire off a custom event that’s being listened for. I personally prefer setter/getters. [import]uid: 59380 topic_id: 10756 reply_id: 39092[/import]

you aren’t limited to any sort of parent/child relationship. You can set up access to whatever you may need.

Since you mention main.lua, you can delcare those functions that you need to use in other files as global functions, and they can be used directly without require from anywhere but the inside of a module that was declared without package.seall, and some usages of setenv() as well. [import]uid: 846 topic_id: 10756 reply_id: 40149[/import]