# Lua API docs

**URL:** <https://community.silverbullet.md/t/lua-api-docs/1662>\
**Category:** Lua\
**Created:** [January 16, 2025, 7:49pm UTC](https://community.silverbullet.md/t/lua-api-docs/1662 "2025-01-16T19:49:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![zef](https://community.silverbullet.md/user_avatar/community.silverbullet.md/zef/32/7_2.png) [@zef](https://community.silverbullet.md/u/zef)\
**Post date:** [January 16, 2025, 7:49pm UTC](https://community.silverbullet.md/t/lua-api-docs/1662/1 "2025-01-16T19:49:13Z")

</div>

I’m experimenting with AI based tooling (have been using Cursor AI recently), and have now generated a whole bunch of API docs for Lua APIs based on the source code and tests, which should be valuable for people playing with Space Lua:

[https://silverbullet.md/API](https://silverbullet.md/API)

I’ve checked some of it and fixed some things, but there may be issues there. I’d be happy to take PRs with fixes to the docs, everything lives here: [silverbullet/website/API at main · silverbulletmd/silverbullet · GitHub](https://github.com/silverbulletmd/silverbullet/tree/main/website/API)

---

<div class="post-metadata">

**Author:** ![LumenYoung](https://community.silverbullet.md/user_avatar/community.silverbullet.md/lumenyoung/32/368_2.png) [@LumenYoung](https://community.silverbullet.md/u/LumenYoung)\
**Post date:** [April 29, 2025, 7:55pm UTC](https://community.silverbullet.md/t/lua-api-docs/1662/2 "2025-04-29T19:55:51Z")

</div>

I think this kind of up to date doc for lua and other api entries should be a very important part of the silverbullet. I wonder if it is better directly generated from the docstring instead of relying on repeated human effort to update them?

---

<div class="post-metadata">

**Author:** ![zef](https://community.silverbullet.md/user_avatar/community.silverbullet.md/zef/32/7_2.png) [@zef](https://community.silverbullet.md/u/zef)\
**Post date:** [April 29, 2025, 8:46pm UTC](https://community.silverbullet.md/t/lua-api-docs/1662/3 "2025-04-29T20:46:48Z")

</div>

Yes I’d agree, but what makes this slightly tricky is that there are three sources of Lua APIs now that all would rely on a different way documenting:

1. Syscalls (defined in typescript in a very specific way): [silverbullet/common/syscalls/system.ts at main · silverbulletmd/silverbullet · GitHub](https://github.com/silverbulletmd/silverbullet/blob/main/common/syscalls/system.ts)
2. Lua specific builtins (defined in typescript in yet another way): [silverbullet/common/space\_lua/stdlib/math.ts at main · silverbulletmd/silverbullet · GitHub](https://github.com/silverbulletmd/silverbullet/blob/main/common/space_lua/stdlib/math.ts)
3. APIs implemented in space lua directly and included e.g. via Library/Std: [silverbullet/Library/Std/Template.md at main · silverbulletmd/silverbullet · GitHub](https://github.com/silverbulletmd/silverbullet/blob/main/Library/Std/Template.md)

---

<div class="post-metadata">

**Author:** ![LumenYoung](https://community.silverbullet.md/user_avatar/community.silverbullet.md/lumenyoung/32/368_2.png) [@LumenYoung](https://community.silverbullet.md/u/LumenYoung)\
**Post date:** [April 29, 2025, 8:51pm UTC](https://community.silverbullet.md/t/lua-api-docs/1662/4 "2025-04-29T20:51:47Z")

</div>

Ah, that could be tricky to deal with. Maybe we need to rely on some specifically designed ci for gathering from these sources? I’ll try to have a look at it once I have time (currently the only available time is used to upgrade to v2).

---

<div class="post-metadata">

**Author:** ![LumenYoung](https://community.silverbullet.md/user_avatar/community.silverbullet.md/lumenyoung/32/368_2.png) [@LumenYoung](https://community.silverbullet.md/u/LumenYoung)\
**Post date:** [April 30, 2025, 3:07pm UTC](https://community.silverbullet.md/t/lua-api-docs/1662/5 "2025-04-30T15:07:27Z")

</div>

As a proof for such need: I just found an undocumented editor method getCurrentLine() that can help me acquire many required line informations. Luckily I can find it from the completion but still would be nice if we ensure the doc is properly there.

---

<div class="post-metadata">

**Author:** ![zef](https://community.silverbullet.md/user_avatar/community.silverbullet.md/zef/32/7_2.png) [@zef](https://community.silverbullet.md/u/zef)\
**Post date:** [April 30, 2025, 5:44pm UTC](https://community.silverbullet.md/t/lua-api-docs/1662/6 "2025-04-30T17:44:42Z")

</div>

Yes absolutely. Docs or it doesn’t exist should be the motto.
