{"id":15538578,"url":"https://github.com/erdian718/lua","last_synced_at":"2025-11-10T01:03:03.813Z","repository":{"id":144204454,"uuid":"183891508","full_name":"erdian718/lua","owner":"erdian718","description":"Go Lua Compiler and VM","archived":false,"fork":false,"pushed_at":"2023-09-15T03:41:49.000Z","size":139,"stargazers_count":24,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-09T12:32:29.108Z","etag":null,"topics":["compiler","go","js","lua","vm","wasm"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"zlib","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erdian718.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2019-04-28T10:08:39.000Z","updated_at":"2024-02-05T23:06:16.000Z","dependencies_parsed_at":"2024-06-21T19:12:30.601Z","dependency_job_id":"f85c1cb7-1385-4de0-ab9b-7617edaaca68","html_url":"https://github.com/erdian718/lua","commit_stats":null,"previous_names":["erdian718/lua"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdian718%2Flua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdian718%2Flua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdian718%2Flua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erdian718%2Flua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erdian718","download_url":"https://codeload.github.com/erdian718/lua/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250458536,"owners_count":21433890,"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":["compiler","go","js","lua","vm","wasm"],"created_at":"2024-10-02T12:04:57.659Z","updated_at":"2025-11-10T01:03:03.767Z","avatar_url":"https://github.com/erdian718.png","language":"Go","readme":"# Go Lua Compiler and VM\n\nThis is a Lua 5.3 VM and compiler written in [Go](http://golang.org/). This is intended to allow easy embedding into Go programs, with minimal fuss and bother. It can also run in a browser by Webassembly.\n\nThis repository is forked from [milochristiansen/lua](https://github.com/milochristiansen/lua), and I made some incompatible changes. So it's unlikely to be merged into the original repository.\n\nThe strftime function and string pattern matching is currently copied from [yuin/gopher-lua](https://github.com/yuin/gopher-lua). It may be rewritten in the future.\n\n## Usage\n\n```go\npackage main\n\nimport (\n\t\"github.com/ofunc/lua/util\"\n)\n\nfunc main() {\n\tl := util.NewState()\n\tutil.Run(l, \"main.lua\")\n}\n```\n\n```lua\nlocal js = require 'js'\nlocal window = js.global\n\nwindow:setTimeout(function()\n\twindow:alert('Hello world!')\nend, 1000)\n```\n\nPlease refer to the README for standard libraries.\n\n## Dependencies\n\n* [Go 1.12+](https://golang.org/)\n\n## Modules\n\n* [ioc](https://github.com/ofunc/ioc) - Inversion of Control module for Lua.\n* [lmodbolt](https://github.com/ofunc/lmodbolt) - boltdb/bolt bindings for Lua.\n* [lmodhttpclient](https://github.com/ofunc/lmodhttpclient) - http.Client bindings for Lua.\n* [lmodmsgpack](https://github.com/ofunc/lmodmsgpack) - MessagePack for Lua.\n* [lmodoffice](https://github.com/ofunc/lmodoffice) - A simple Lua module for converting various office documents into OOXML format files.\n* [lmodxlsx](https://github.com/ofunc/lmodxlsx) - plandem/xlsx bindings for Lua.\n* [mithril](https://github.com/ofunc/mithril) - Mithril.js bindings for Lua.\n* [stream](https://github.com/ofunc/stream) - A simple lazy list module for Lua.\n\n## Missing Stuff\n\nThe following standard functions are not available:\n\n* `collectgarbage` (not possible, VM uses the Go collector)\n* `xpcall` (VM has no concept of a message handler)\n* `next` (I don't need it at this time)\n* `load` (violates my security policy)\n* `dofile` (violates my security policy, use `require`)\n* `loadfile` (violates my security policy, use `require`)\n* `string.dump` (violates my security policy)\n* `string.pack` (I don't need it at this time, use [msgpack](https://github.com/ofunc/lmodmsgpack))\n* `string.packsize` (I don't need it at this time, use [msgpack](https://github.com/ofunc/lmodmsgpack))\n* `string.unpack` (I don't need it at this time, use [msgpack](https://github.com/ofunc/lmodmsgpack))\n\n* * *\n\nThe following standard modules are not available:\n\n* `package` (violates my security policy, use `util.AddPath`)\n* `debug` (violates my security policy)\n* `coroutine` (no coroutine support yet, use goroutine)\n\n* * *\n\nThe following modules are not implemented exactly as the Lua 5.3 specification requires:\n\n* `math.random` (initialize the seed by default using program startup time)\n* `os` (Go style functions)\n* `io` (Go style functions)\n\n* * *\n\nThere are a few things that are implemented exactly as the Lua 5.3 specification requires, where the reference\nLua implementation does not follow the specification exactly:\n\n* The `#` (length) operator always returns the number of positive integer keys. When the table is a sequence, it's exactly equal to the sequence's length.\n* Modulo operator (`%`) is implemented the same way most languages implement it, not the way Lua does. This does not matter unless you are using negative operands.\n\n* * *\n\nThe following *core language* features are not supported:\n\n* Hexadecimal floating point literals are not supported at this time.\n* Weak references of any kind are not supported. This is because the VM uses Go's garbage collector, and it does not support weak references.\n* Finalizers are not supported.\n\n## TODO\n\n* More tests.\n* Better error hints.\n* Code optimization.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferdian718%2Flua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferdian718%2Flua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferdian718%2Flua/lists"}