-
Notifications
You must be signed in to change notification settings - Fork 128
Extra functions
MY-BASIC contains severial utility functions which are not written inside the core/my_basic.c, but in the shell/main.c. This page describes all these functions.
beep
beep
Beeps once with the speaker. The simplest sample for writing a customized scripting interface function.
gc
gc()
Tries to trigger garbage collection, and returns how much bytes collected.
now
now()/now(FORMAT_STRING)
Gets a current time string.
Parameter format:
| Specifier | Replaced by | Example |
|---|---|---|
| None | Represent Www Mmm dd hh:mm:ss yyyy | Sat Jun 20 09:29:00 2015 |
| %D | Short MM/DD/YY date | 06/20/15 |
| %F | Short YYYY-MM-DD date | 2015-06-20 |
| %T | ISO 8601 time format (HH:MM:SS) | 14:55:02 |
| %R | 24-hour HH:MM time | 14:55 |
| More... | Refer to strftime |
os
os()
Gets current OS name.
raise
raise()/raise(ABORT_CODE)
Raises an error with or without an abort code.
set_importing_dirs
set_importing_dirs(DIRS)
Sets importing directories.
DIRS are directory pathes separated by semicolons, eg. "data;data/res;../data;../data/res".
sys
sys(COMMAND)
Invokes a system command.
ticks
ticks()
Gets the elapsed tick count since system bootup in millisecond.
trace
trace()
Gets and prints the execution stack frames. Assuming we got below:
def fun()
trace()
enddef
def foo()
fun()
enddef
def bar()
foo()
enddef
bar()It would print top down FUN <- FOO <- BAR.
- Principles
- Coding
- Data types
- Standalone shell
- Integration
- Customization
- More scripting API
- FAQ