1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-12-16 05:00:31 +00:00
CC-Tweaked/src/web/mount/expr_template.lua
Jonathan Coates a4c9e89370
Runnable examples (#576)
Provides a basic interface for running examples on tweaked.cc. This is probably
janky as anything, but it works on my machine.

This is the culmination of 18 months of me building far too much infrastructure
(copy-cat, illuaminate), so that's nice I guess.

I should probably get out more.
2020-11-12 19:01:50 +00:00

15 lines
285 B
Lua

local result = table.pack(__expr__
)
if result.n == 0 then return end
local pp = require "cc.pretty"
local line = {}
for i = 1, result.n do
if i > 1 then line[#line + 1] = pp.text(", ") end
line[#line + 1] = pp.pretty(result[i])
end
pp.print(pp.concat(table.unpack(line)))