# Can't get script working

**URL:** https://community.silverbullet.md/t/cant-get-script-working/3565
**Category:** Lua
**Created:** [November 20, 2025, 7:00pm UTC](https://community.silverbullet.md/t/cant-get-script-working/3565 "2025-11-20T19:00:56Z")
**Posts on this page:** 8
**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 20, 2025, 7:00pm UTC](https://community.silverbullet.md/t/cant-get-script-working/3565/1 "2025-11-20T19:00:56Z")

</div>

Hello, I’m a new user (one day old) and I’d like to get a function working in my pages.  
Let me know if this is not the spot to post these questions!

I added the following function within a page, and tried to call it with `${transform_calorie_text(...)}`, which didn’t really work (function is still nil). Am I supposed to do something more to make the function available? Do I have to declare this somewhere else?

```space-lua
function transform_calorie_text(text)
    local result = {}

    for line in text:gmatch("[^\r\n]+") do
        local before, inside = line:match("^(.-)%((.-)%)$")
        if before and inside then
            inside = inside:gsub("c", "")
            before = before:gsub("%s*$", "")
            table.insert(result, before .. "\t=" .. inside)
        end
    end

    return table.concat(result, "\n")
end

```

---

<div class="post-metadata">

### Author: ![thepaperpilot](https://community.silverbullet.md/user_avatar/community.silverbullet.md/thepaperpilot/32/1557_2.png) [@thepaperpilot](https://community.silverbullet.md/u/thepaperpilot)
#### Post date: [November 20, 2025, 7:09pm UTC](https://community.silverbullet.md/t/cant-get-script-working/3565/2 "2025-11-20T19:09:03Z")

</div>

if you haven’t already, run the `System: Reload` command

---

<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 20, 2025, 7:19pm UTC](https://community.silverbullet.md/t/cant-get-script-working/3565/3 "2025-11-20T19:19:25Z")

</div>

Nope, doesn’t help

---

<div class="post-metadata">

### Author: ![Mr.Red](https://community.silverbullet.md/user_avatar/community.silverbullet.md/mr.red/32/821_2.png) [@Mr.Red](https://community.silverbullet.md/u/Mr.Red)
#### Post date: [November 20, 2025, 7:44pm UTC](https://community.silverbullet.md/t/cant-get-script-working/3565/4 "2025-11-20T19:44:15Z")

</div>

it’s the “\t=” space-lua doesnt seems to recognise it.

 ![image](https://community.silverbullet.md/uploads/default/original/2X/7/7cbfeb582f3d087aeab413a8775570f9b4e71c95.png)

you can see the red marker there, that means something is wrong with the syntax. If you wanted to add the literal tab character, try this:

```auto
table.insert(result, before .. string.char(9) .. "=" .. inside)

```

 ![image](https://community.silverbullet.md/uploads/default/original/2X/8/8fa7f8c078a6053bc60e82d3893ee1fa44b5a7b9.png)

---

<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 20, 2025, 7:47pm UTC](https://community.silverbullet.md/t/cant-get-script-working/3565/5 "2025-11-20T19:47:45Z")

</div>

Ah, I didn’t realize. I tried this on another lua interpreter and it was ok. Thanks for the help!

---

<div class="post-metadata">

### Author: ![mjf](https://community.silverbullet.md/user_avatar/community.silverbullet.md/mjf/32/654_2.png) [@mjf](https://community.silverbullet.md/u/mjf)
#### Post date: [November 21, 2025, 8:37am UTC](https://community.silverbullet.md/t/cant-get-script-working/3565/6 "2025-11-21T08:37:01Z")

</div>

Caused by bug. Fix [PR](https://github.com/silverbulletmd/silverbullet/pull/1698)-ed.

---

<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: [November 21, 2025, 8:37am UTC](https://community.silverbullet.md/t/cant-get-script-working/3565/7 "2025-11-21T08:37:27Z")

</div>

Just merged it, should be available on the edge builds soon.

---

<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 23, 2025, 1:15am UTC](https://community.silverbullet.md/t/cant-get-script-working/3565/8 "2025-11-23T01:15:32Z")

</div>

that’s great! thanks a lot @mjf @zef
