{"id":17252659,"url":"https://github.com/myuon/minilight-lua","last_synced_at":"2026-05-15T12:07:39.930Z","repository":{"id":147363712,"uuid":"261816047","full_name":"myuon/minilight-lua","owner":"myuon","description":"A binding library of minilight for Lua langauge","archived":false,"fork":false,"pushed_at":"2020-05-16T06:00:32.000Z","size":435,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-06T01:44:04.387Z","etag":null,"topics":["haskell","lua"],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/myuon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-06T16:24:09.000Z","updated_at":"2020-05-16T06:00:30.000Z","dependencies_parsed_at":"2023-07-06T22:32:34.738Z","dependency_job_id":null,"html_url":"https://github.com/myuon/minilight-lua","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/myuon/minilight-lua","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myuon%2Fminilight-lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myuon%2Fminilight-lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myuon%2Fminilight-lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myuon%2Fminilight-lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/myuon","download_url":"https://codeload.github.com/myuon/minilight-lua/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/myuon%2Fminilight-lua/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33066172,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["haskell","lua"],"created_at":"2024-10-15T06:54:20.369Z","updated_at":"2026-05-15T12:07:39.903Z","avatar_url":"https://github.com/myuon.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# minilight-lua\n\n[![Hackage](http://img.shields.io/hackage/v/minilight-lua.svg)](https://hackage.haskell.org/package/minilight-lua) [![MIT license](http://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nA binding library of [minilight](https://github.com/myuon/minilight) for Lua language.\n\n*NB: This package is in the very early stage.*\n\n## What's this?\n\n- [minilight](http://hackage.haskell.org/package/minilight) is a SDL2-based graphics library, equipped with component system.\n- [Lua](https://www.lua.org) is a lightweight interpreted language.\n\nWith this library, you can write a minilight component in Lua language.\n\n## Getting Started\n\nSee [example](https://github.com/myuon/minilight-lua/tree/master/example) directory. `Main.hs` is an entrypoint for minilight engine.\n\n```hs\nmainFile = \"example/main.lua\"\n\nmain :: IO ()\nmain = runLightT $ runMiniloop\n  (defConfig { hotConfigReplacement = Just \"example\", appConfigFile = Just \"\" })\n  initial\n  (const mainloop)\n where\n  initial = do\n    comp \u003c- registerComponent mainFile newLuaComponent\n    reload mainFile\n\n    return ()\n\n  mainloop :: MiniLoop ()\n  mainloop = do\n    ref \u003c- view _events\n    evs \u003c- liftIO $ tryReadMVar ref\n\n    let notifys = case evs of\n          Just evs -\u003e mapMaybe asNotifyEvent evs\n          _        -\u003e []\n    unless (null notifys) $ reload mainFile\n```\n\nSome notes here:\n\n- When you pass `hotConfigReplacement` field, minilight will watch the given directory and emits *file changed/created/delete* events during the mainloop.\n- For `registerComponent` you need to pass the filename like `example/main.lua`. The path is relative where you run `cabal run`.\n- In `mainloop`, watches any events and `reload` the component. The `reload` function will load the lua file again and swap the component dynamically (code swapping).\n\n```lua\nlocal minilight = require(\"minilight\")\n\nfunction onDraw()\n    print(\"[LUA OUTPUT] hello\")\n\n    return {\n        minilight.translate(50, 50, minilight.picture(\"example/example.png\")),\n        minilight.translate(100, 100, minilight.text(\"こんにちは世界\",\n                                                     {0, 0, 0, 0})),\n        minilight.translate(30, 50,\n                            minilight.text(\"Hello, World!\", {255, 0, 0, 0}))\n    }\nend\n\n_G.onDraw = onDraw\n```\n\nFor lua part:\n\n- Require `minilight` library. This will be implicitly loaded by minilight-lua.\n- You need to export `onDraw : () -\u003e Array\u003cminilight.Figure\u003e` function globally. This function will be called from Haskell and the returned array will be rendered in the component.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyuon%2Fminilight-lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmyuon%2Fminilight-lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmyuon%2Fminilight-lua/lists"}