🐐 ORDINA
This commit is contained in:
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user