# Using JS function in Space Lua

**URL:** <https://community.silverbullet.md/t/using-js-function-in-space-lua/3593>\
**Category:** Lua\
**Created:** [November 27, 2025, 9:13pm UTC](https://community.silverbullet.md/t/using-js-function-in-space-lua/3593 "2025-11-27T21:13:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Krishna-Sivakumar](https://community.silverbullet.md/user_avatar/community.silverbullet.md/krishna-sivakumar/32/2262_2.png) [@Krishna-Sivakumar](https://community.silverbullet.md/u/Krishna-Sivakumar)\
**Post date:** [November 27, 2025, 9:13pm UTC](https://community.silverbullet.md/t/using-js-function-in-space-lua/3593/1 "2025-11-27T21:13:00Z")

</div>

Is it possible to expose a function written in a plug as a lua function? How can I do this?

---

<div class="post-metadata">

**Author:** ![MrMugame](https://community.silverbullet.md/user_avatar/community.silverbullet.md/mrmugame/32/358_2.png) [@MrMugame](https://community.silverbullet.md/u/MrMugame)\
**Post date:** [November 27, 2025, 9:45pm UTC](https://community.silverbullet.md/t/using-js-function-in-space-lua/3593/2 "2025-11-27T21:45:17Z")

</div>

I wrote about this some time ago here

  ![MrMugame](https://community.silverbullet.md/user_avatar/community.silverbullet.md/mrmugame/20/358_2.png) 

MrMugame

[2025-11-04 13:27:14 UTC](https://community.silverbullet.md/chat/c/-/2/t/314/3544 "2025-11-04 13:27:14 UTC")
[General](https://community.silverbullet.md/chat/c/-/2)|[](https://community.silverbullet.md/chat/c/-/2/t/314)

@markalex If you are actually talking about plugs, we have to make a distinction. Plugs can define "functions" and "syscalls". Functions are basically a core part of the plug system. _Everything_ is a function, i.e. commands, code widgets, document editors, etc. In a manifest it's the entries you define like this

```yaml
name: example
functions:
  foo:
    path: ....
    command: ....

```

Where `foo` is now a function. These functions can be manually invoked (using a syscall), like this `system.invokeFunction("example.foo", ...);`. This is a little clunky though, so there is basically a short circuit way, which are called syscalls and are defined like this.

```auto
name: example
functions:
  foo:
    path: ....
    syscall: "example.foo"

```

Now you can call your function like this `example.foo(...)` and it'll be available everywhere.

---

<div class="post-metadata">

**Author:** ![Krishna-Sivakumar](https://community.silverbullet.md/user_avatar/community.silverbullet.md/krishna-sivakumar/32/2262_2.png) [@Krishna-Sivakumar](https://community.silverbullet.md/u/Krishna-Sivakumar)\
**Post date:** [November 27, 2025, 10:59pm UTC](https://community.silverbullet.md/t/using-js-function-in-space-lua/3593/3 "2025-11-27T22:59:27Z")

</div>

Yeah, this perfectly fits my use case.  
Would it be possible to add this and other plug-related information to the main website?
