Add the "ZS.System.Command" function

Add the "ZS.System.Command" function in order to run console commands. Something like pythons os.system() function.
This commit is contained in:
Rexo35 2022-08-23 18:29:36 +02:00 committed by GitHub
parent 926a8e60f7
commit adcbe1f232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,7 @@
#include <ctime>
#include <math.h>
#include <sys/stat.h>
#include <cstdlib> // for console command printing
#include "strops.h"
#include "graphics.h"
@ -467,6 +468,8 @@ boost::any ZSFunction(const string& name, const vector<boost::any>& args)
Vec2 v(AnyAsFloat(args.at(0)), AnyAsFloat(args.at(1)));
return v;
}
else if (name == "ZS.System.Command")
temp = system(StringRaw(AnyAsString(args.at(0))));
else
LogWarning("ZS function \'" + name + "\' does not exist.");