Skip to content

中文 | English

API: wingman.util ​

Utility function module providing common helper functionality.

Module Overview ​

The util module provides general-purpose utility functions:

  • Time functions - get timestamps, delay execution
  • Log output - print logs

Delayed Execution ​

sleep(milliseconds) / sleep(milliseconds) ​

Description: Delays execution for the given number of milliseconds.

Signature:

python
sleep(milliseconds: int) -> None
lua
sleep(milliseconds: number) -> nil

Parameters:

  • milliseconds - the number of milliseconds to delay

Returns:

  • None
python
from wingman import util

# 延迟 1000 毫秒
util.sleep(1000)

# 延迟 2 秒
util.sleep(2000)

Getting a Timestamp ​

getTime() / getTime() ​

Description: Gets the current timestamp (in milliseconds).

Signature:

python
getTime() -> int
lua
getTime() -> number

Returns:

  • the current timestamp (in milliseconds)
python
from wingman import util

# 获取当前时间戳(毫秒)
timestamp = util.getTime()
print(f"当前时间戳: {timestamp}")

Log Output ​

log(message) / log(message) ​

Description: Prints a log message to the console.

Signature:

python
log(message: str) -> None
lua
log(message: string) -> nil

Parameters:

  • message - the log message

Returns:

  • None
python
from wingman import util

# 输出日志
util.log("这是一条日志信息")

Available Interfaces ​

Python FunctionLua FunctionDescriptionParameters
sleep(milliseconds)sleep(milliseconds)Delay executionmilliseconds: number of milliseconds
getTime()getTime()Get a timestampReturns: timestamp in milliseconds
log(message)log(message)Print a log messagemessage: log message