Files
Nasal-Interpreter/balloon/lib/basics.nas
T
Valk Richard Li b985f6ce9a add new functions
2019-11-26 21:13:12 +08:00

36 lines
854 B
Plaintext

# this file includes basic operation functions:
# append
# subvec
# int
# num
# made by github user: ValKmjolnir
# append is used to add a new var into an array/vector
var append=func(vector,elements...)
{
return __call_special_inline_function(vector,elements);
};
# subvec is used to get a new array from an exist array
var subvec=func(vector,begin,length)
{
var new_vector=[];
for(var i=begin;i<begin+length;i+=1)
{
append(new_vector,vector[i]);
}
return new_vector;
};
# int function is used to transfer double var into int var
# the normal type of number in balloon script is double
var int=func(value)
{
return __Cpp_inline_var_to_int(value);
};
# num function is used to translate a string into a number
var num=func(value)
{
return __call_Cpp_type_trans_num(value);
};