I’m not exactly sure I’m getting what you’re asking, but I think I might…
If you pass the function as an argument to another function, you simply call the argument. However, if it is a local function, it must be defined ABOVE wherever you intend to call it.
So for example…
[blockcode]
local function testMeWithAFunction( _theFunction )
– The following won’t work, because at this point, printHello() doesn’t exist
_theFunction()
end
local function printHello ()
print (“Hello”)
end
testMeWithAFunction ( printHello )
[/blockcode]
However, if you do it this way, things will work:
[blockcode]
local function printHello()
print(“Hello”)
end
local function testMeWithAFunction( _theFunction )
– the following WILL work, because printHello() DOES exist at this point:
_theFunction()
end
testMeWithAFunction( printHello )
[/blockcode] [import]uid: 7849 topic_id: 7494 reply_id: 26562[/import]