Problem with Types ... Guru needed please!

Blitz3D Forums/Blitz3D Programming/Problem with Types ... Guru needed please!

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

hed, if you really want to store your events for each character in a stack (LIFO - Last In First Out) then you can do something like the following:

Type eventT
	Field a
	Field b
	Field next_event.eventT
End Type

Type characterT
	Field ID
	Field stack.eventT
End Type

; Create a character.
my_char.characterT = New characterT
my_char\ID = 1

; Create an event.
event.eventT = New eventT
event\a = 1
event\b = 2

; Push (add) event to character's stack.
push_event(my_char,event)

; Pop (get) event from top of character's stack.
event.eventT = pop_event(my_char)

If event <> Null
	; Do stuff with the event.
	Print event\a
	Print event\b
	
	; Delete it.
	Delete event
EndIf

;
; Place specified event on top of character's stack.
;
Function push_event(c.characterT, e.eventT)

	e\next_event = c\stack
	c\stack = e
	
End Function

;
; Retrieve event from top of character's stack.
;
Function pop_event.eventT(c.characterT)

	e.eventT = c\stack

	If e <> Null Then c\stack = e\next_event
	
	Return e

End Function


[EDIT] oops. had a couple of typos.