-
Notifications
You must be signed in to change notification settings - Fork 0
/
Example_-_message_queue.lua
42 lines (36 loc) · 990 Bytes
/
Example_-_message_queue.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
-- MessageQueues
-- shows how to create a list of
-- messages. you can add new
-- messages. the first added
-- message is shown and removed
-- waiting for the message that
-- wad added after that one.
-- Use this function to perform your initial setup
function setup()
print("Hello World!")
queue = {}
table.insert(queue,"Welcome to this app")
table.insert(queue,"this text is queued")
table.insert(queue,"the last added is last shown.")
table.insert(queue,"the end")
cnt = 0
show ="Welcome"
end
-- This function gets called once every frame
function draw()
-- This sets a dark background color
background(40, 40, 50)
-- This sets the line thickness
strokeWidth(5)
-- Do your drawing here
if #queue>0 then
cnt=cnt+1
if cnt>200 then
cnt=0
table.remove(queue,1)
if #queue>0 then show = queue[1] end
end
end
fill(255)
text(show,WIDTH/2,HEIGHT/2)
end