mirror of
https://github.com/janet-lang/janet
synced 2025-01-12 16:40:27 +00:00
Add curenv to core.
This commit is contained in:
parent
5377e10532
commit
f7c556ed8d
@ -2,6 +2,7 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## Unreleased - ???
|
||||
- Add `(curenv)`.
|
||||
- Change `net/read`, `net/chunk`, and `net/write` to raise errors in the case of failures.
|
||||
- Add `janet_continue_signal` to C API. This indirectly enables C functions that yield to the event loop
|
||||
to raise errors or other signals.
|
||||
|
@ -2069,6 +2069,14 @@
|
||||
(if ec "\e[0m" "")))
|
||||
(eflush))
|
||||
|
||||
(defn curenv
|
||||
"Get the current environment table. Same as (fiber/getenv (fiber/current)). If n
|
||||
is provided, gets the nth prototype of the environment table."
|
||||
[&opt n]
|
||||
(var e (fiber/getenv (fiber/current)))
|
||||
(if n (repeat n (if (= nil e) (break)) (set e (table/getproto e))))
|
||||
e)
|
||||
|
||||
(defn run-context
|
||||
"Run a context. This evaluates expressions in an environment,
|
||||
and is encapsulates the parsing, compilation, and evaluation.
|
||||
|
Loading…
Reference in New Issue
Block a user