changeset 13956:f50a9746fec0

util.queue: Convenience functions for empty/full
author Matthew Wild <mwild1@gmail.com>
date Thu, 25 Sep 2025 16:54:23 +0100
parents 01f95f3de6fc
children 8e6baa66f828
files util/queue.lua
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/util/queue.lua	Thu Sep 25 16:53:35 2025 +0100
+++ b/util/queue.lua	Thu Sep 25 16:54:23 2025 +0100
@@ -21,6 +21,8 @@
 		_items = t;
 		size = size;
 		count = function (self) return items; end;
+		empty = function () return items == 0; end;
+		full = function () return items == size; end;
 		push = function (self, item)
 			if items >= size then
 				if allow_wrapping then