print("Notification board v1.0") -- Number of rows local lineSize = 12 -- Text array local arr = {} -- Initialize the array for i = 1, lineSize do arr[i] = "" end -- Add text function addText(text) -- Shift the position of the text for i = 0, lineSize - 2 do arr[lineSize-i] = arr[lineSize-i-1] end -- Shift the latest text to the top arr[1] = text -- Synthesize the text for i = 2, lineSize do text = text..'\n'..arr[i] end -- Display the text vci.assets._ALL_SetText("Text", text) end -- Receive notification function onMessage(sender, name, message) local text if message == 'joined' then text = sender.name..'joined the room.' elseif message == 'left' then text = sender.name..'left the room.' end print(text) if vci.assets.IsMine then addText(text) end end -- Subscribe the notification vci.message.On('notification', onMessage) -- Dummy notification for testing function test() for i = 1, 50 do local sender = { name='Test'..i } local message = 'joined' if i % 2 == 0 then message = 'left' end onMessage(sender, 'notification', message) end end -- Run the test code test()