{"id":15415006,"url":"https://github.com/lxsmnsyc/lua-wc3-module","last_synced_at":"2025-10-12T04:07:17.392Z","repository":{"id":71066939,"uuid":"184227132","full_name":"lxsmnsyc/Lua-Wc3-Module","owner":"lxsmnsyc","description":"module system for Lua Warcraft 3","archived":false,"fork":false,"pushed_at":"2019-04-30T10:02:59.000Z","size":4,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-27T05:16:32.814Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","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/lxsmnsyc.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-30T08:52:49.000Z","updated_at":"2024-10-24T04:25:40.000Z","dependencies_parsed_at":"2023-02-24T18:00:25.980Z","dependency_job_id":null,"html_url":"https://github.com/lxsmnsyc/Lua-Wc3-Module","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"42722d6ad8571fa244f7af4a4abdb0dbd24e4e69"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/lxsmnsyc/Lua-Wc3-Module","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxsmnsyc%2FLua-Wc3-Module","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxsmnsyc%2FLua-Wc3-Module/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxsmnsyc%2FLua-Wc3-Module/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxsmnsyc%2FLua-Wc3-Module/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lxsmnsyc","download_url":"https://codeload.github.com/lxsmnsyc/Lua-Wc3-Module/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxsmnsyc%2FLua-Wc3-Module/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260009214,"owners_count":22945425,"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-01T17:05:33.434Z","updated_at":"2025-10-12T04:07:12.355Z","avatar_url":"https://github.com/lxsmnsyc.png","language":"Lua","readme":"# Lua-Wc3-Module\n\nmodule system for Lua Warcraft 3\n\nThere are two kinds of module systems:\n- Dependent module system\n- Async module system\n\nThe dependent module system prevents circular dependency internally. The downside is that it doesn't allow asynchronous module loading (unlike the built-in Lua require). It also requires you to declare the dependency modules. This module system also allows you to load all modules.\n\nThe async module system is like the Lua require module system. The difference is that module are declared inside a callback (since Wc3 Lua doesn't have IO). The difference between async module system and dependent module system is that the async doesn't prevent circular dependency, but it allows async module loading. Another downside is that you need to defined the module entrypoint of which you want to load.\n\n## Example Dependent Module\n\n```lua\nrequire \"Lua-Wc3-Module\"\nmodule.create(\"A\")(function ()\n  print(\"module A loaded\")\n  return 100\nend)\nmodule.create(\"B\")(function ()\n  print(\"module B loaded\")\n  return 200\nend)\nmodule.create(\"C\")(function ()\n  print(\"module C loaded\")\n  return function (a, b)\n    return a + b\n  end\nend)\nmodule.create(\"D\", {\"A\", \"B\", \"C\"})(function (imports)\n  print(\"module D loaded\")\n  return imports.C(imports.A, imports.B)\nend)\nmodule.create(\"E\")(function ()\n  print(\"module E loaded\")\n  return print\nend)\nmodule.create(\"F\", {\"D\", \"E\"})(function (imports)\n  print(\"module F loaded\")\n  imports.E(imports.D)\nend)\nmodule.init()\n```\n\n## Example Async Module\n\n```lua\n\nrequire \"Lua-Wc3-Module\"\n\nmodule.create(\"A\", function() return 100 end)\nmodule.create(\"B\", function() return 200 end)\nmodule.create(\"add\", function ()\n  return function (a, b)\n    return a + b\n  end\nend)\nmodule.create(\"print\", function ()\n  return print\nend)\nmodule.create(\"addAB\", function (require)\n  local A = require(\"A\")\n  local B = require(\"B\")\n  local add = require(\"add\")\n  return add(A, B)\nend)\nmodule.create(\"init\", function (require)\n  require(\"print\")(require(\"addAB\"))\nend)\n\nmodule.load(\"init\")\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flxsmnsyc%2Flua-wc3-module","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flxsmnsyc%2Flua-wc3-module","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flxsmnsyc%2Flua-wc3-module/lists"}