- Joined
- Apr 23, 2011
- Messages
- 460
I have been writing pseudo code now and I am almost 90% sure that when you instantiate a struct via structname.create() or thistype.create() it will assign that struct a unique reference, but I haven't coded in a long time, and have some uncertainty either way. If I store a variable as
this will reference the integer or class object of the struct instantiated correct? To clarify: If I were to create a struct reference, and store the data in a later function outside the struct, if the values are public, can I use something like this:
This is riddled with syntax errors and problems, but hopefully you're looking at the underlying concepts. This is just to demonstrate.
JASS:
local thistype this = thistype.create()
JASS:
globals
timer t = CreateTimer()
endglobals
struct Test
local thistype this = thistype.create()
local integer i = 0
local string hello = ""
call SetTimerData(t, this)
call TimerStart(t, 1., false, function Testing)
endstruct
function Testing takes nothing returns nothing
local Test t = GetTimerData(GetExpiredTimer())
set t.hello = "Hello!"
endfunction
This is riddled with syntax errors and problems, but hopefully you're looking at the underlying concepts. This is just to demonstrate.