Exfyre
hmm...
- Reaction score
- 60
how would I pass a function as an argument so that it can be called remotely?
library ExecuteCode
globals
private trigger t = CreateTrigger()
endglobals
function ExecuteCode takes code c returns nothing
call TriggerAddAction(t, c)
call TriggerExecute(t)
call TriggerClearActions(t)
endfunction
endlibrary
globals
string array functions
endglobals
function HelloWorld takes nothing returns nothing
call BJDebugMsg( "Hello World" )
endfunction
function DomoSekai takes nothing returns nothing
call BJDebugMsg( "Domo Sekai ~Kimi Unko!" )
endfunction
function BrokeBackFootmen takes nothing returns nothing
call CreateUnit( Player(0), 039;hfoo039;, 0, 0, 0 )
call CreateUnit( Player(0), 039;hfoo039;, 100, 0, 0 )
endfunction
function Actions takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 2
call ExecuteFunc( functions<i> )
set i = i + 1
endloop
endfunction
function Init takes nothing returns nothing
set functions[0] = "HelloWorld"
set functions[1] = "DomoSekai"
set functions[2] = "BrokeBackFootmen"
endfunction
</i>
function interface BasicFunction takes nothing returns nothing
globals
BasicFunction array functions
endglobals
function HelloWorld takes nothing returns nothing
call BJDebugMsg( "Hello World" )
endfunction
function DomoSekai takes nothing returns nothing
call BJDebugMsg( "Domo Sekai ~Kimi Unko!" )
endfunction
function BrokeBackFootmen takes nothing returns nothing
call CreateUnit( Player(0), 039;hfoo039;, 0, 0, 0 )
call CreateUnit( Player(0), 039;hfoo039;, 100, 0, 0 )
endfunction
function Actions takes nothing returns nothing
local integer i = 0
loop
exitwhen i > 2
call functions<i>.execute()
set i = i + 1
endloop
endfunction
function Init takes nothing returns nothing
set functions[0] = HelloWorld
set functions[1] = DomoSekai
set functions[2] = BrokeBackFootmen
endfunction</i>