Experiments in using Lua with sol2 and how best to structure the data. Contains a shoot out of SOA, vs AOS vs. MOA. SOA = Struct of Arrays AOS = Array of Structs MOA = Many Array of Structs (kind of a hybrid)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sol2_test/lua/bezos_builder.lua

42 lines
701 B

DECK = Builder.new()
function config(x)
for k,v in pairs(x) do
DECK:config_set(k, v);
end
end
function slide(x)
local s = DECK:slide_start()
for k, v in pairs(x) do
if type(k) == "string" then
DECK:slide_config(s, k, v)
else
local ntype, ncontent = v[1], v[2]
local node_id = DECK:node_add(s, ntype, ncontent)
end
end
end
function t(content)
return {NodeType.TEXT, content}
end
function h1(content)
return {NodeType.H1, content}
end
function image(settings)
return {NodeType.IMAGE, settings}
end
function ul(content)
return {NodeType.UL, content}
end
function rgba(colors)
return Color.new(colors[1], colors[2], colors[3], colors[4])
end