{"id":15400782,"url":"https://github.com/agraef/lua-tk","last_synced_at":"2026-02-06T18:02:06.754Z","repository":{"id":43777213,"uuid":"511623705","full_name":"agraef/lua-tk","owner":"agraef","description":"Lua interface to Tcl/Tk","archived":false,"fork":false,"pushed_at":"2022-07-25T19:40:40.000Z","size":93,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-06T15:53:42.758Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/agraef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-07T17:49:15.000Z","updated_at":"2024-02-16T09:53:27.000Z","dependencies_parsed_at":"2022-09-24T01:02:01.734Z","dependency_job_id":null,"html_url":"https://github.com/agraef/lua-tk","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/agraef/lua-tk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agraef%2Flua-tk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agraef%2Flua-tk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agraef%2Flua-tk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agraef%2Flua-tk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/agraef","download_url":"https://codeload.github.com/agraef/lua-tk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/agraef%2Flua-tk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265281543,"owners_count":23739880,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-10-01T15:54:55.830Z","updated_at":"2026-02-06T18:02:01.721Z","avatar_url":"https://github.com/agraef.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lua Tk module\n\nThis module provides a basic interface between Lua and Tcl/Tk. The operations of this module allow you to execute arbitrary commands in the Tcl interpreter, set and retrieve variable values in the interpreter, and invoke Lua callbacks from Tcl/Tk. It should thus provide all the machinery required to code fairly sophisticated Tcl/Tk applications in Lua.\n\nThis is a fairly straightforward port of the corresponding Pure module, see \u003chttps://agraef.github.io/pure-docs/pure-tk.html\u003e. It implements most of the basic operations of that module in Lua, but lacks some of the more advanced functionality. A brief synopsis of the available functions can be found below. Please also check the examples folder for some sample Lua scripts showing how to utilize this module.\n\n## Installation\n\nYou'll need Lua, of course (Lua 5.2 or later should be fine, 5.4 has been tested), and Tcl/Tk (8.6 has been tested). (A few of the examples may also need additional Tcl modules, such as Gnocl and VTK, please check the Tcl sources for details.)\n\nThis version comes with a rockspec which lets you conveniently install the module using [luarocks](https://luarocks.org/).\n\nTo build and install: `sudo luarocks install lua-tk`\n\nTo uninstall: `sudo luarocks remove lua-tk`\n\nThe module can also be installed in the usual way if you don't have luarocks, as follows:\n\nTo build and install: `make \u0026\u0026 sudo make install`\n\nTo uninstall: `sudo make uninstall`\n\n## Synopsis\n\nTo load this module: `tk = require(\"tk\")`\n\n`tk.eval(s)`: Executes the command `s` (a string) in the Tcl interpreter. An instance of the interpreter will be created if none is currently running.\n\nIn the Tcl interpreter, you can call back to Lua using the Tcl `lua` command which is invoked as `lua function args ...`, where `function` is the name of a Lua function (which must be global), and `args` are the (string) arguments the function is to be invoked with.\n\n`tk.quit()`: Stop the Tcl interpreter.\n\n`tk.main()`: Call the Tk main loop which keeps processing events until either `tk.quit()` is called or the main window of the application is closed.\n\n`tk.ready()`: Checks whether the Tcl interpreter is still up and running, after processing any pending events in the interpreter. This provides an alternative to `tk.main()` which enables you to code your own custom main loops in Lua.\n\n`tk.set(var, val)`, `tk.unset(var)`, `tk.get(var)`: Set and get global Tcl variables.\n\n`tk.join(xs)`, `tk.split(s)`: Convert between Lua and Tcl lists.\n\n## Notes\n\nThere are various Tcl add-on packages which can be useful for Lua programmers. In particular, you may want to look at [Gnocl](https://dr-baum.net/gnocl/), which lets you create nice-looking GTK+ GUIs in Tcl, and [VTK](https://www.vtk.org/), a powerful scientific visualization package which has Tcl bindings. As I find these so useful, and ready-made packages can be hard to find, I've provided some suitable Arch and Debian/Ubuntu packages for your convenience. You can find the former in the Arch User Repositories ([Gnocl](https://aur.archlinux.org/packages?O=0\u0026K=gnocl), [VTK](https://aur.archlinux.org/packages/vtk6-legacy)), and the latter at the Open Build Service ([Gnocl](https://build.opensuse.org/project/show/home:aggraef:gnocl), [VTK](https://build.opensuse.org/project/show/home:aggraef:vtk6)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagraef%2Flua-tk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fagraef%2Flua-tk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fagraef%2Flua-tk/lists"}