Utility functions||doc136813

September 20, 2022

Brief Introduction

Here are some useful tool functions


string getYearMonthStr(int time  )

The timestamp is converted to the month and year, and the result is as shown in 201909

string getYearWeekStr(int time  )

Timestamp conversion adult weeks, the results are as follows: 201939

int getWeeksOfYear(int time  )

What week is the current acquisition

int getYearDayStr(int time  )

Get today is the day of the year

int getMonthStartTime(int time  )

Get the start timestamp of this month

int getWeekStartTime(int time  )

Get the start timestamp of this week

int getDayStartTime(int time  )

Get today's start timestamp

int getMonthEndTime(int time  )

Get the end timestamp of this month

int getWeekEndTime(int time  )

Get the end timestamp of this week

int getDayEndTime(int time  )

Get today's end timestamp

void isSameDay(int time1,  int time2  )

Judge whether the two timestamps are the same day

boolean isSameWeek(int time1,  int time2  )

Judge whether the two timestamps are the same week

Vector3 randPosInRegion(table region)

Obtain random points in an area

table derive(table base,  table derive  )

Returns a derived class that inherits the base class

int getTableSize(table tb)

Return the quantity of contents in the table

void pv(variant value,  int maxLevel,  variant tips  )

Print any type of output

float v3AngleXZ(Vector3 v  )

Calculate the rotation angle of the vector on the Y axis

float getPosDistance(Vector3 pos1,  Vector3 pos2  )

Get the distance between two points

table splitString(string str,  string sep,  boolean to_number  )

Split string contents according to characters

Vector3 posAroundYaw(Vector3 pos,  float rotationYaw  )

Returns the coordinate position after the coordinate rotates around the Y axis relative to the origin

table copy(table tb)

Deep copy the data in the table