{"id":31848863,"url":"https://github.com/matttuttle/hx-lua","last_synced_at":"2025-10-12T10:52:34.268Z","repository":{"id":17347714,"uuid":"20119165","full_name":"MattTuttle/hx-lua","owner":"MattTuttle","description":"Simple lua wrapper in a haxe extension","archived":false,"fork":false,"pushed_at":"2014-05-29T15:16:02.000Z","size":2190,"stargazers_count":41,"open_issues_count":2,"forks_count":8,"subscribers_count":9,"default_branch":"master","last_synced_at":"2023-03-11T23:27:25.385Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","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/MattTuttle.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}},"created_at":"2014-05-24T01:25:25.000Z","updated_at":"2022-12-05T05:02:52.000Z","dependencies_parsed_at":"2022-09-25T08:35:44.795Z","dependency_job_id":null,"html_url":"https://github.com/MattTuttle/hx-lua","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/MattTuttle/hx-lua","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattTuttle%2Fhx-lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattTuttle%2Fhx-lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattTuttle%2Fhx-lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattTuttle%2Fhx-lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MattTuttle","download_url":"https://codeload.github.com/MattTuttle/hx-lua/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MattTuttle%2Fhx-lua/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011065,"owners_count":26084865,"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","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-10-12T10:52:31.525Z","updated_at":"2025-10-12T10:52:34.263Z","avatar_url":"https://github.com/MattTuttle.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Run Lua code in Haxe\n====================\n\nRun any Lua code inside Haxe on neko/cpp targets. Has the option of passing a context object that will set variables before running the script.\n\n```haxe\nvar result = Lua.run(\"return true\"); // returns a Bool to Haxe\n```\n\nPass in values with a context object. The key names are used as variable names in the Lua script.\n```haxe\nvar result = Lua.run(\"if num \u003e 14 then return 14 else return num end\", {num: 15.3});\n```\n\nWhat if you want to call a function created in Haxe from Lua? Just pass the function in the context!\n```haxe\nvar result = Lua.run(\"return plus1(15)\", { plus1: function(val:Int) { return val + 1; } });\nif (result == 16)\n\ttrace(\"success!\");\n```\n\nLua instances\n=============\n\nIt's possible to create multiple Lua instances to run scripts with different contexts/libraries.\n\n```haxe\nvar lua = new Lua();\nlua.loadLibs([\"base\", \"math\"]);\nlua.setVars({ myVar: 1 });\nvar result = lua.execute(\"return myVar\");\n```\n\nCalling Lua functions\n---------------------\n\nCalling global functions defined in lua can be done after executing a chunk of Lua code. You can either pass in a single value (for single argument functions) or an array (for multiple argument functions).\n\n```haxe\nvar lua = new Lua();\nlua.execute(\"function add(a, b) return a + b end\");\nvar result = lua.call(\"add\", [1, 5]); // returns 6\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatttuttle%2Fhx-lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatttuttle%2Fhx-lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatttuttle%2Fhx-lua/lists"}