implement if.else()

This commit is contained in:
suchmememanyskill
2021-07-09 23:46:21 +02:00
parent 623634b515
commit 65a28d8ef6
8 changed files with 55 additions and 10 deletions

22
source/script/else.c Normal file
View File

@@ -0,0 +1,22 @@
#include "else.h"
ClassFunction(scriptElse) {
if (!caller->integer.value) {
Variable_t* res = genericCallDirect(args[0], NULL, 0);
if (res == NULL)
return NULL;
removePendingReference(res);
}
return &emptyClass;
}
u8 elseOneFunction[] = { FunctionClass };
ClassFunctionTableEntry_t elseFunctions[] = {
{"else", scriptElse, 1, elseOneFunction},
};
Variable_t getElseMember(Variable_t* var, char* memberName) {
return getGenericFunctionMember(var, memberName, elseFunctions, ARRAY_SIZE(elseFunctions));
}