_builtin
– Convenience functions¶
Added in 1.1.0.
This special module is loaded on the parser’s initialization.
Note
Since version 1.1.0, this module replaces the Special functions (tool functions).
Also, it is now the module where MODULE_FUNCTIONS
is stored.
Contents¶
Replacements for the tool functions¶
At version 1.0.0, we used to have something called tool functions,
a bunch of static “functions” that were available everywhere, anytime.
But since version 1.1.0, we decided to move those functions into this
library. That way, you can both replace these functions with functions
from other libraries, and load them again by loading _builtin
.
- cd(arg)¶
- chdir(arg)¶
- Parameters:
arg – The path where to move.
Change the current working directory to arg. It returns a Text of the new current working directory.
- print_available_functions(arg)¶
- Parameters:
arg – A mandatory argument. This function won’t use it at all.
Print the available functions, and their origin.
- load_module(*args)¶
- Parameters:
args – An undefined number of text values to load.
This loads a library from
diddiparser2.lib
, and all their contents. It loads as many libraries as you request.
- load_extension(*args)¶
- Parameters:
args – An undefined number of text values to load.
This will load an extension. An extension is a Python file that can be imported from the current working directory. This function loads as many libraries as you request.
Note
If the “extensions file” directory is not listed by default on
sys.path
, use theadd_extensions_location()
function first (see below).See also
- DSGP 3
The DSGP that provides a guide for extensions.
Stuff loaded from the simpleio
library¶
The following functions are taken from the simpleio
library. The reference for the original functions can be
found at simpleio – Common I/O interactions.
- print_text(arg)¶
A shortcut for
simpleio.print_text
.
- print_line(arg)¶
A shortcut for
simpleio.print_line
.
- store_input(arg)¶
A shortcut for
simpleio.store_input
.
- warning(arg)¶
A shortcut for
simpleio.warning
.
Other functions¶
- add_extensions_location(arg)¶
- Parameters:
arg – A text-like path.
This function extends
sys.path()
, enabling more locations to export extensions. It should be used beforeload_extension()
, in case the “extensions file” is not included insys.path()
.