🐐 ORDINA

This commit is contained in:
2026-04-21 21:48:56 +02:00
parent 108e69291d
commit e61009b6ef
8 changed files with 75 additions and 1 deletions

View File

@@ -1122,6 +1122,17 @@ class BuiltIn(Node):
case "EVERRO":
print("\033[2J\033[H", end="", flush=True)
return vtable, ValNul()
case "ORDINA":
if not isinstance(params[0], ValList):
raise CentvrionError("ORDINA requires an array")
items = list(params[0].value())
if not items:
return vtable, ValList([])
all_numeric = all(isinstance(i, (ValInt, ValFrac)) for i in items)
all_string = all(isinstance(i, ValStr) for i in items)
if not (all_numeric or all_string):
raise CentvrionError("ORDINA requires all elements to be numbers or all strings")
return vtable, ValList(sorted(items, key=lambda v: v.value()))
case "TYPVS":
type_map = {
ValInt: "NVMERVS", ValStr: "LITTERA", ValBool: "VERAX",