Yeah. Might be worth investigating again. There is in fact an already existing but undocumented method of drawing some shapes on screen:
-- Once at start
local primitives = sys.get_ext "primitives"
local p = primitives.create_primitives()
p:quad(10, 10, 400, 400, 1,1,1,1) -- top left, bottom right, rgba
p:triangle(30, 90, 100, 300, 300, 30, 1,0,0,1) -- vertex 1, 2, 3 and rgba
p:line(40, 40, 900, 900, 0,1,1,1)
-- draw once or multiple times
The reason this isn’t documented is that I don’t really like the API and the result isn’t very fast as it issues a bunch of immediate mode GL calls. Directly exposing GL within Lua is also not really an option as the API should always be safe to use, so you cannot accidentally mess up the GL state. I’m not sure how to best solve all this.