{"id":16204472,"url":"https://github.com/leinlin/luareload-unity","last_synced_at":"2025-03-19T07:31:18.035Z","repository":{"id":108216857,"uuid":"234086488","full_name":"leinlin/luareload-unity","owner":"leinlin","description":null,"archived":false,"fork":false,"pushed_at":"2020-01-15T13:30:16.000Z","size":7215,"stargazers_count":30,"open_issues_count":0,"forks_count":10,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T04:43:11.727Z","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":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leinlin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.TXT","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-01-15T13:27:39.000Z","updated_at":"2024-11-14T23:21:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"f5a88d62-c2b1-4f6a-b58c-55fcdb114af6","html_url":"https://github.com/leinlin/luareload-unity","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leinlin%2Fluareload-unity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leinlin%2Fluareload-unity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leinlin%2Fluareload-unity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leinlin%2Fluareload-unity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leinlin","download_url":"https://codeload.github.com/leinlin/luareload-unity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244379140,"owners_count":20443404,"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-10T09:58:22.689Z","updated_at":"2025-03-19T07:31:18.030Z","avatar_url":"https://github.com/leinlin.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"## 使用\n\n打开 Examples 里面的 UI scene，然后修改 Resources 目录下的 ButtonInteraction.lua.txt 中的 两个click函数\n\n函数开始的执行代码\n```\nlocal hardreload = require 'hardreload'\nrequire = hardreload.require\n```\n某个文件,假设为 updatefileName.lua，发生变化的时候执行\n```\nlocal hardreload = require 'hardreload' \nhardreload.reload(updatefileName);\n```\nunity 结合 类AssetPostprocessor进行使用\n\n![](docs/use.gif)\n\n## 特点\n没有啥代码格式限制，基本上的只要你调用一个 reload函数输入参数文件名即可\n\n## 说明\n\n```\nui = {}\n\n-- 修改a、b两个变量无法 热重载，无法添加 local变量\nlocal a = 12345\nlocal b = {test = 2}\n\nlocal function button2Click()\n\t-- 你可以随便修改添加这个函数的局部变量以及逻辑\n\tlocal c = \"foo c\"\n\tlocal d = \"foo d\"\n\tprint(\"button233 click:\" ..\"c:\".. tostring(c)  ..\" a:\".. tostring(a))\n\tprint(\"d:\" .. d)\nend\n\nlocal function button1Click()\n\t-- 你可以随便修改添加这个函数的局部变量以及逻辑\n\tprint(\"button1 click:\" .. tostring(a))\nend\n\nfunction ui:start()\n\tprint(\"lua start...\")\n\tself.button1:GetComponent(\"Button\").onClick:AddListener(function()\n\t\t-- 你可以随便修改添加这个函数的局部变量以及逻辑\n\t\tprint(\"callback click:\" .. \"a:\" ..tostring(a) ..\"b.test:\" ..tostring(b.test))\n\t\tbutton1Click()\n\tend)\n\n\tself.button2:GetComponent(\"Button\").onClick:AddListener(button2Click)\nend\n```\n\n## 已知问题\n* 直接修改函数外部的local变量无法热重载，如果修改一个外部的local函数内容可以热重载\n* 删掉一个local 函数，然后再次添加回去 函数之后无法热重载，建议多多使用self函数\n\n## 联系方式\n如果您发现啥BUG可以加入QQ群：[882425563](https://jq.qq.com/?_wv=1027\u0026k=5QkOBSc) 与我们联系\n\n## 使用框架地址\nhttps://github.com/cloudwu/luareload/tree/proto","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleinlin%2Fluareload-unity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleinlin%2Fluareload-unity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleinlin%2Fluareload-unity/lists"}