[script] vector slicing, basic file functions

new operators:
vector(int, byte) - int -> works like py's list[0:-int]
vector(int, byte) : int -> works like py's list[int:]

new functions:
fileRead, fileWrite, fileExists, bytesToStr
This commit is contained in:
suchmememanyskill
2021-01-01 18:30:51 +01:00
parent 3d4182ec57
commit e1f292fe0d
8 changed files with 84 additions and 12 deletions

View File

@@ -343,6 +343,25 @@ Variable_t solveEquation(scriptCtx_t* ctx, lexarToken_t* tokens, u32 len, u8 sho
vecAddElement(&res.vectorType, in);
}
}
ELIFT(Minus){
if (val.integerType >= res.vectorType.count)
return ErrValue(ERRSYNTAX);
res.vectorType.count -= val.integerType;
Vector_t newV = vecCopy(&res.vectorType);
freeVariable(res);
res.vectorType = newV;
res.free = 1;
}
ELIFT(Selector){
if (val.integerType >= res.vectorType.count)
return ErrValue(ERRSYNTAX);
Vector_t newV = vecCopyOffset(&res.vectorType, val.integerType);
freeVariable(res);
res.vectorType = newV;
res.free = 1;
}
}
else if (res.varType == StringType && val.varType == IntType){
if (localOpToken == Minus){