Something went wrong. Try again.
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334-- sued Lua test script - Arsalan "Aeri" Kazmi-- Licensed under the Apache License, Version 2.0, same as sued.-- This script is written to test sued's Lua environment.-- sued is a minimalist line-based text editor written by myself in Rust.-- When running sued using `cargo run` with at least the `repl` and `lua`-- features enabled, run `~script samples/sued-lua-test.lua` in the REPL.
print("Hello, world, from " .. _VERSION .. "!") -- in sued, it's Lua 5.4
print("Do we have access to the sued buffer?")
if sued.buffer.contents then print("Yes, so we're running under sued!")else print("No! Go and get some sued in your life!") print("https://codeberg.org/AeriaVelocity/sued") return falseend
-- At this point, we've already checked for the existence of `sued.buffer.contents`-- That means we can safely assume we're able to access and manipulate it
if #sued.buffer.contents == 0 then print("But it's empty! How are we supposed to do anything with this?!") return trueend
print("Here's everything in the buffer:")for index, line in ipairs(sued.buffer.contents) do print(index .. "│" .. line)end
print("Wait a minute, sued's `main.lua` already does that.")print_buffer()