Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dictu stdlib #471

Merged
merged 16 commits into from
Nov 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/docs/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ If however you wish to import something specific from the module into the curren
accepts a single identifier or multiple separated by a comma.

```cs
from Math import PI;
from Math import pi;

PI; // 3.14...
pi; // 3.14...

// Import multiple things
from JSON import parse, stringify;
Expand Down
64 changes: 64 additions & 0 deletions docs/docs/standard-lib/inspect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
layout: default
title: Inspect
nav_order: 14
parent: Standard Library
---

# Inspect
{: .no_toc }

## Table of contents
{: .no_toc .text-delta }

1. TOC
{:toc}

---

## Inspect
To make use of the Inspect module an import is required.

```js
import Inspect;
```

### Inspect.getFrameCount()

This gives you the current frame count of the VM at the point of calling.

Note: This is 0-based.

```cs
Inspect.getFrameCount(); // 0

def test() {
print(Inspect.getFrameCount());
}

test(); // 1
```

### Inspect.getLine(number: count -> optional)

This gives you the line number within the file that the function was called from.

The optional argument passed is the amount of frames to traverse back up. If this number exceeds the
frame count an error is raised.

```cs
Inspect.getLine(); // 1
Inspect.getLine(1000); // Optional argument passed to getLine() exceeds the frame count.
```

### Inspect.getFile(number: count -> optional)

This gives you the name of the file that the function was called from.

The optional argument passed is the amount of frames to traverse back up. If this number exceeds the
frame count an error is raised.

```cs
Inspect.getFile(); // repl
Inspect.getFile(); // myFile.du
```
Loading