| CARVIEW |
Select Language
HTTP/1.1 200 OK
Connection: keep-alive
Server: nginx/1.24.0 (Ubuntu)
Content-Type: text/html; charset=utf-8
Cache-Control: public, max-age=300
Content-Encoding: gzip
Via: 1.1 varnish, 1.1 varnish
Accept-Ranges: bytes
Age: 0
Date: Sat, 17 Jan 2026 22:42:02 GMT
X-Served-By: cache-dfw-kdfw8210138-DFW, cache-bom-vanm7210068-BOM
X-Cache: MISS, MISS
X-Cache-Hits: 0, 0
X-Timer: S1768689721.253498,VS0,VE871
Vary: Accept, Accept-Encoding
transfer-encoding: chunked
minilight-lua: A binding library of minilight for Lua langauge.
minilight-lua: A binding library of minilight for Lua langauge.
Modules
[Index] [Quick Jump]
Downloads
- minilight-lua-0.2.1.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.1.0.0, 0.2.0.0, 0.2.1.0 |
|---|---|
| Change log | CHANGELOG.md |
| Dependencies | base (>=4.13.0.0 && <4.14), bytestring (>=0.10), containers, exceptions (>=0.10), hslua (>=1.1), lens, linear (>=1.20), minilight (>=0.5.0), minilight-lua, mtl (>=2.2), sdl2 (>=2.4 && <2.5), sdl2-ttf, text (>=1.2), unix-time (>=0.4) [details] |
| License | MIT |
| Author | myuon |
| Maintainer | ioi.joi.koi.loi@gmail.com |
| Uploaded | by myuon at 2020-05-16T06:00:13Z |
| Category | Graphics |
| Source repo | head: git clone https://github.com/myuon/minilight-lua.git |
| Distributions | |
| Executables | example |
| Downloads | 592 total (5 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating |
|
| Status | Docs uploaded by user Build status unknown [no reports yet] |
Readme for minilight-lua-0.2.1.0
[back to package description]minilight-lua
A binding library of minilight for Lua language.
NB: This package is in the very early stage.
What's this?
- minilight is a SDL2-based graphics library, equipped with component system.
- Lua is a lightweight interpreted language.
With this library, you can write a minilight component in Lua language.
Getting Started
See example directory. Main.hs is an entrypoint for minilight engine.
mainFile = "example/main.lua"
main :: IO ()
main = runLightT $ runMiniloop
(defConfig { hotConfigReplacement = Just "example", appConfigFile = Just "" })
initial
(const mainloop)
where
initial = do
comp <- registerComponent mainFile newLuaComponent
reload mainFile
return ()
mainloop :: MiniLoop ()
mainloop = do
ref <- view _events
evs <- liftIO $ tryReadMVar ref
let notifys = case evs of
Just evs -> mapMaybe asNotifyEvent evs
_ -> []
unless (null notifys) $ reload mainFile
Some notes here:
- When you pass
hotConfigReplacementfield, minilight will watch the given directory and emits file changed/created/delete events during the mainloop. - For
registerComponentyou need to pass the filename likeexample/main.lua. The path is relative where you runcabal run. - In
mainloop, watches any events andreloadthe component. Thereloadfunction will load the lua file again and swap the component dynamically (code swapping).
local minilight = require("minilight")
function onDraw()
print("[LUA OUTPUT] hello")
return {
minilight.translate(50, 50, minilight.picture("example/example.png")),
minilight.translate(100, 100, minilight.text("こんにちは世界",
{0, 0, 0, 0})),
minilight.translate(30, 50,
minilight.text("Hello, World!", {255, 0, 0, 0}))
}
end
_G.onDraw = onDraw
For lua part:
- Require
minilightlibrary. This will be implicitly loaded by minilight-lua. - You need to export
onDraw : () -> Array<minilight.Figure>function globally. This function will be called from Haskell and the returned array will be rendered in the component.