add "version_is_older" script function

This commit is contained in:
GenevensiS
2026-05-11 10:29:29 +02:00
parent 24abf8fe86
commit b13de8e099
3 changed files with 28 additions and 0 deletions
+1
View File
@@ -138,5 +138,6 @@ These functions are built into the program, other [[type:function]]s can be defi
| [[fun:assert]] Check a condition for debugging purposes.
| [[fun:warning]] Output a warning message.
| [[fun:error]] Output an error message.
| [[fun:version_is_older]] Checks if a version number is older than another.
| [[fun:exists_as_package]] Checks if a package exists.
| [[fun:exists_in_package]] Checks if a file exists in a package.
+18
View File
@@ -0,0 +1,18 @@
Function: version_is_older
--Usage--
> version_is_older("version", than: "other version")
Check if a version number is strictly older than another.
Malformed version numbers, including nil, are treated as 0-0-0.
--Parameters--
! Parameter Type Description
| @input@ [[type:string]] Version we want to check.
| @than@ [[type:string]] Version we want to check against.
--Examples--
> version_is_older("2025-06-28", than: "2026-02-18") == true
> version_is_older("2026-02-18", than: "2026-02-18") == false
> version_is_older(nil, than: "0-0-1") == true