{"id":15826290,"url":"https://github.com/thelartians/luaglue","last_synced_at":"2026-03-03T18:32:09.631Z","repository":{"id":55710771,"uuid":"259884544","full_name":"TheLartians/LuaGlue","owner":"TheLartians","description":"Lua bindings for the Glue library","archived":false,"fork":false,"pushed_at":"2023-01-29T17:35:10.000Z","size":62,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-10T18:49:35.687Z","etag":null,"topics":["bindings","cpp","glue","lua","lua-bindings"],"latest_commit_sha":null,"homepage":"https://github.com/TheLartians/Glue","language":"C++","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/TheLartians.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}},"created_at":"2020-04-29T09:40:34.000Z","updated_at":"2023-03-05T09:00:54.000Z","dependencies_parsed_at":"2023-02-16T00:15:43.206Z","dependency_job_id":null,"html_url":"https://github.com/TheLartians/LuaGlue","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":"TheLartians/ModernCppStarter","purl":"pkg:github/TheLartians/LuaGlue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheLartians%2FLuaGlue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheLartians%2FLuaGlue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheLartians%2FLuaGlue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheLartians%2FLuaGlue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheLartians","download_url":"https://codeload.github.com/TheLartians/LuaGlue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheLartians%2FLuaGlue/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30054590,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T18:21:05.932Z","status":"ssl_error","status_checked_at":"2026-03-03T18:20:59.341Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["bindings","cpp","glue","lua","lua-bindings"],"created_at":"2024-10-05T09:44:02.542Z","updated_at":"2026-03-03T18:32:09.612Z","avatar_url":"https://github.com/TheLartians.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Actions Status](https://github.com/TheLartians/LuaGlue/workflows/MacOS/badge.svg)](https://github.com/TheLartians/LuaGlue/actions)\n[![Actions Status](https://github.com/TheLartians/LuaGlue/workflows/Windows/badge.svg)](https://github.com/TheLartians/LuaGlue/actions)\n[![Actions Status](https://github.com/TheLartians/LuaGlue/workflows/Ubuntu/badge.svg)](https://github.com/TheLartians/LuaGlue/actions)\n[![Actions Status](https://github.com/TheLartians/LuaGlue/workflows/Style/badge.svg)](https://github.com/TheLartians/LuaGlue/actions)\n[![Actions Status](https://github.com/TheLartians/LuaGlue/workflows/Install/badge.svg)](https://github.com/TheLartians/LuaGlue/actions)\n[![codecov](https://codecov.io/gh/TheLartians/LuaGlue/branch/master/graph/badge.svg)](https://codecov.io/gh/TheLartians/LuaGlue)\n\n# LuaGlue\n\nLua bindings for [Glue](https://github.com/TheLartians/Glue).\n\n## Usage\n\n### Example\n\nUsing LuaGlue you can interact with Lua using a simple binding interface.\nThe following example illustrates the basic usage.\n\n```cpp\n#include \u003cglue/lua/state.h\u003e\n#include \u003ciostream\u003e\n\nvoid exampleBasics() {\n  glue::lua::State state;\n  state.openStandardLibs();\n\n  // run Lua code\n  state.run(\"print('Hello Lua!')\");\n\n  // extract values\n  std::cout \u003c\u003c state.get(\"'Hello' .. ' ' .. 'C++!'\")-\u003eget\u003cstd::string\u003e() \u003c\u003c std::endl;\n\n  // extract maps\n  auto map = state.get(\"({a=1, b='2'})\").asMap();\n  map[\"a\"]-\u003eget\u003cint\u003e(); // -\u003e 1\n\n  // extract functions\n  auto f = state.get(\"function(a,b) return a+b end\").asFunction();\n  f(3, 4).get\u003cint\u003e(); // -\u003e 7\n\n  // inject values\n  auto global = state.root();\n  global[\"x\"] = 42;\n  global[\"square\"] = [](double x){ return x*x; };\n  \n  // interact with Lua directly\n  state.run(\"print(square(x))\");\n  // or using Glue\n  global[\"print\"](global[\"square\"](global[\"x\"]));\n}\n```\n\nClasses and inheritance are also supported.\n\n```cpp\n#include \u003cglue/class.h\u003e\n\nstruct A {\n  std::string member;\n  A(std::string m): member(m) {}\n  auto method() const { return \"member: \" + member; }\n};\n\nvoid exampleModules() {\n  glue::lua::State state;\n  state.openStandardLibs();\n\n  // inject C++ classes and APIs into JavaScript\n  auto module = glue::createAnyMap();\n  \n  module[\"A\"] = glue::createClass\u003cA\u003e()\n    .addConstructor\u003cstd::string\u003e()\n    .addMember(\"member\", \u0026A::member)\n    .addMethod(\"method\", \u0026A::method)\n  ;\n\n  state.addModule(module, state.root());\n\n  state.run(\"a = A.__new('test');\");\n  state.run(\"print(a:member());\");\n  state.run(\"print(a:method());\");\n}\n```\n\nCheck the [API](include/glue/lua/state.h) and [tests](test/source/state.cpp) for functionality and examples.\nSee [here](https://github.com/TheLartians/TypeScriptXX) for a full example project using automatic TypeScript declarations.\n\n### Adding to your project\n\nLuaGlue can be easily integrated through CPM.\nIf not available before, this will automatically add a Lua and Glue target as well.\n\n```cmake\nCPMAddPackage(\n  NAME LuaGlue\n  VERSION 1.1.2\n  GITHUB_REPOSITORY TheLartians/LuaGlue\n)\n\ntarget_link_libraries(myLibrary LuaGlue)\n```\n\n### Build and run tests\n\nTo build and run the tests, run the following commands from the project's root.\n\n```bash\ncmake -Htest -Bbuild\ncmake --build build -j8\n./build/LuaGlueTests\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthelartians%2Fluaglue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthelartians%2Fluaglue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthelartians%2Fluaglue/lists"}