- Joined
- Aug 7, 2013
- Messages
- 1,338
Hi,
Suppose I've got a bunch of structs which are different kinds of wrappers around
Let's further suppose they all have a unit instance field called "u."
Now suppose I want to write a single function that disables/enables invulnerability for that unit u. Is this possible? It'd be up to the client to make sure they pass in a struct which has a unit field named "u."
I don't think that works yet, but is there a way to make this function?
Suppose I've got a bunch of structs which are different kinds of wrappers around
unit
but they don't actually have any inheritance/extension relations. Let's further suppose they all have a unit instance field called "u."
Now suppose I want to write a single function that disables/enables invulnerability for that unit u. Is this possible? It'd be up to the client to make sure they pass in a struct which has a unit field named "u."
JASS:
function setStructUnitInvulnerable takes integer whichStruct, boolean flag returns nothing
call SetUnitInvulnerable(whichStruct.u, flag)
endfunction
I don't think that works yet, but is there a way to make this function?