{"id":21339059,"url":"https://github.com/capsadmin/one-click-lua-launch","last_synced_at":"2025-03-16T02:22:52.529Z","repository":{"id":150429774,"uuid":"151109992","full_name":"CapsAdmin/one-click-lua-launch","owner":"CapsAdmin","description":"a way to launch lua in one click on Linux, macOS and Windows via os scripts","archived":false,"fork":false,"pushed_at":"2018-10-03T11:40:09.000Z","size":23,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-22T15:11:37.006Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Batchfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CapsAdmin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2018-10-01T15:17:28.000Z","updated_at":"2022-10-11T11:17:07.000Z","dependencies_parsed_at":"2023-04-24T17:27:07.169Z","dependency_job_id":null,"html_url":"https://github.com/CapsAdmin/one-click-lua-launch","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/CapsAdmin%2Fone-click-lua-launch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CapsAdmin%2Fone-click-lua-launch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CapsAdmin%2Fone-click-lua-launch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CapsAdmin%2Fone-click-lua-launch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CapsAdmin","download_url":"https://codeload.github.com/CapsAdmin/one-click-lua-launch/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243814979,"owners_count":20352077,"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-11-22T00:42:02.706Z","updated_at":"2025-03-16T02:22:52.192Z","avatar_url":"https://github.com/CapsAdmin.png","language":"Batchfile","funding_links":[],"categories":[],"sub_categories":[],"readme":"### About\n\nThis is a way of running Lua with a mouse click on Linux, macOS and Windows. \nIt supports a way to detect if ran from a file browser or command line, arguments,\nshortcuts on Windows (with arguments) and a nice way of showing errors.\n\nIt works by simply downloading the Lua executable with Shell or Batch from the internet. \nBy default, the scripts download files to `./data/*` but you can also set it to \nwrite to `$HOME/.appexample` on Unix or`%appdata%\\appexample` on Windows\nif you want.\n\n### DownloadFile helper function\n```bash\n# bash\n# Uses wget or curl\nDownloadFile \"https://foobar.com/baz\" \"baz\"\n```\n\n```batch\n:: batch\n:: Uses curl or powershell\ncall:DownloadFile \"https://foobar.com/baz.exe\" \"baz.exe\"\n```\nThe DownloadFile function on Windows will use curl, powershell or Windows Script Host\ndepending on what's available. It should work on windows 2000 and up, but beware of the\nlack of https support on old versions of windows.\n\nWhen downloading an executable it's good practice to run validation afterwards \nto make sure it works. For example, if `lua_downloaded_and_validated` \ndoesn't exist download luajit.exe, check if the exit code is correct by running\n`os.exit` and if successful write `lua_downloaded_and_validated` to the same \ndirectory indicating that it's been downloaded and validated. This is what\nthe example scripts do.\n\n### How is it possible to allow Lua in Shell and Batch?\nBoth of the scripts use some syntax to allow writing Lua code at beginning of each script. \nBatch uses the following:\n```lua\n::_::BATCH_PROGRAM=[[\n...\ngoto:eof\nrem ]]\n```\n\nWhich requires goto labels in Lua to be valid. This can be replaced with the following \nif Lua 5.1 is desired.\n```lua\nrem = nil BATCH_PROGRAM=[[\n...\ngoto:eof\nrem ]]\n```\n\nThe Shell version uses the following:\n```lua\n#!/bin/sh\nSHELL_PROGRAM=[=[\n...\nexit 0\n]=]\n```\nWhich looks a bit more natural.\n\nThese hacks are not strictly nesseceary as you change the script\nto download an external Lua script and just execute that instead.\n\n### Why not powershell or WSH on Windows?\nI use Batch because it has a significant faster startup time than Powershell. \nWindows script host (.js or .vb) is fast but has some limitations when it comes \nto being executed from command line vs explorer. \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapsadmin%2Fone-click-lua-launch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcapsadmin%2Fone-click-lua-launch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcapsadmin%2Fone-click-lua-launch/lists"}