| 06-15-2009, 06:41 AM | #1 |
JASS:scope test //imagine this is a system ( does not complie properly .... ) function interface what takes unit target returns nothing private function test takes nothing returns nothing local unit u = GetTriggerUnit() call what.execute(u) set u = null endfunction endscope // And this is the external function to call the system scope test private function abc takes unit target returns nothing local what d = what.abc call KillUnit(target) endfunction endscope Doing it right or wrong and explain to me how to make it work or how does it work. Don't link me to jasshelper because I have seen it. |
| 06-15-2009, 07:15 AM | #2 | |
Quote:
what is a typename... .execute should be called on the instance, not the type itself. |
| 06-15-2009, 07:38 AM | #3 |
JASS:scope tester //imagine this is a system ( does not complie properly .... ) function interface what takes unit target returns nothing private function test takes nothing returns nothing local unit u = GetTriggerUnit() local what d call d.execute(u) // starting the instance in the "system" set u = null endfunction endscope // And this is the external function to call the system scope test private function abc takes unit target returns nothing local what d = what.abc // so when d.execute is called upon that instance this should fire too? call KillUnit(target) // killing it endfunction endscope Something like this? |
| 06-15-2009, 07:49 AM | #4 | |
Quote:
That will now compile, but will do nothing. You need to pass the instance from outside via parameters or globals. Edit: Oh, I didn't notice the signature inconsistency... |
| 06-15-2009, 09:06 AM | #5 |
JASS:function interface MyInterface takes unit someUnit returns nothing private function testFunction takes unit u returns nothing call KillUnit(u) endfunction // ========== local MyInterface f = testFunction call f.execute( any_unit_you_would_like_to_kill ) |
