-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSys.ark
More file actions
38 lines (33 loc) · 1.42 KB
/
Sys.ark
File metadata and controls
38 lines (33 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# @brief Execute a system specific command
# @details Return the output of the command as a String, or nil if it was disabled in the ArkScript build
# @param command the command to execute, as a String
# =begin
# (sys:exec "echo hello")
# =end
# @author https://github.com/SuperFola
(let exec (fun (_command) (builtin__sys:exec _command)))
# @brief Sleep for a given duration (in milliseconds)
# @details Return nil
# @param duration a Number representing a duration
# =begin
# (sys:sleep 1000) # sleep for 1 second
# =end
# @author https://github.com/SuperFola
(let sleep (fun (_duration) (builtin__sys:sleep _duration)))
# @brief Exit the program with the given exit code
# @details Any code after this function call won't be executed
# @param exitCode usually 0 for success and 1 for errors
# =begin
# (sys:exit 0) # halt the virtual machine with given exit code (success)
# =end
# @author https://github.com/SuperFola
(let exit (fun (_code) (builtin__sys:exit _code)))
# @brief Platform on which the program is running (Windows, Mac OSX, Linux, FreeBSD, Unix, Other)
# @author https://github.com/SuperFola
(let platform builtin__sys:platform)
# @brief Arguments given to the program when running it from the command line
# @author https://github.com/SuperFola
(let args builtin__sys:args)
# @brief Name of the running program (file only, not the fullpath)
# @author https://github.com/SuperFola
(let programName builtin__sys:programName)