Hello World — Getting Started with Lua

· 2 min read · 347 words
#getting-started#lua#tutorial

Welcome to the blog! This post showcases all the features available when writing content in SilverBullet and publishing it here

Markdown Basics

You can write with all standard markdown features:

Blockquotes work great for highlighting important information or quotes from other sources.

Code Blocks

Here’s a regular code block with syntax highlighting:

function greet(name) {
return `Hello, ${name}!`;
}
console.log(greet("World"));

Tables

FeatureStatusNotes
Markdown renderingFull CommonMark support
Syntax highlightingVia Expressive Code
Lua executionPowered by Fengari
Dark modeSystem + manual toggle

Interactive Lua Code

The coolest feature — you can run Lua code right in the browser! Click the Run button below:

print("Hello from Lua! 🌙")
print("This runs directly in your browser")
print("2 + 2 = " .. tostring(2 + 2))

Lua Functions

Define a function in one block and use it in the next. The Lua VM is shared across all blocks on the page:

-- Define a utility function
function fibonacci(n)
if n <= 1 then return n end
return fibonacci(n - 1) + fibonacci(n - 2)
end
-- Print first 10 fibonacci numbers
for i = 0, 9 do
print("fib(" .. i .. ") = " .. fibonacci(i))
end

More Lua Examples

-- String manipulation
local greeting = "Hello, Blog!"
print(string.upper(greeting))
print(string.rep("=", #greeting))
print("Length: " .. #greeting .. " characters")
-- Tables (Lua's primary data structure)
local colors = {"red", "green", "blue", "purple"}
for i, color in ipairs(colors) do
print(i .. ". " .. color)
end

Images

You can include images using standard markdown syntax. Images from your SilverBullet space will render if they’re in the content directory.

What’s Next?

  1. Write more posts in SilverBullet
  2. Add published: true to the frontmatter
  3. Posts appear on the blog automatically

Happy writing! ✍️

Comments (0)

No comments yet.