{"id":30857745,"url":"https://github.com/04ar/flutter_embed_lua","last_synced_at":"2026-05-08T19:33:25.339Z","repository":{"id":312909511,"uuid":"1049129111","full_name":"04AR/flutter_embed_lua","owner":"04AR","description":"A Lua binding plugin for Flutter, enabling seamless integration of Lua scripting capabilities within your Flutter applications.","archived":false,"fork":false,"pushed_at":"2025-09-02T14:27:48.000Z","size":195,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-02T19:37:16.253Z","etag":null,"topics":["embed","flutter","lua"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/04AR.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-02T14:25:23.000Z","updated_at":"2025-09-02T14:30:20.000Z","dependencies_parsed_at":"2025-09-02T19:37:18.537Z","dependency_job_id":"c673c75d-95cb-4144-97e4-c8f0f4ab4482","html_url":"https://github.com/04AR/flutter_embed_lua","commit_stats":null,"previous_names":["04ar/flutter_embed_lua"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/04AR/flutter_embed_lua","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/04AR%2Fflutter_embed_lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/04AR%2Fflutter_embed_lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/04AR%2Fflutter_embed_lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/04AR%2Fflutter_embed_lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/04AR","download_url":"https://codeload.github.com/04AR/flutter_embed_lua/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/04AR%2Fflutter_embed_lua/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274045976,"owners_count":25212978,"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-09-07T02:00:09.463Z","response_time":67,"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":["embed","flutter","lua"],"created_at":"2025-09-07T13:33:43.299Z","updated_at":"2026-05-08T19:33:25.333Z","avatar_url":"https://github.com/04AR.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flutter_embed_lua\n\n\u003cdiv\u003e\n  \u003ca href=https://pub.dev/packages/flutter_embed_lua target=\"_blank\"\u003e\u003cimg src=https://img.shields.io/badge/Pub%20Package-blue.svg?logo=flutter height=22px\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n🚀 **flutter_embed_lua** is a Flutter plugin that embeds a full **Lua runtime** inside your Flutter application. It allows you to **extend your app functionality at runtime** by running Lua scripts, defining custom functions, and bridging Lua with Dart.\n\n---\n\n## ✨ Features\n\n- 🌀 **Run Lua scripts** directly inside your Flutter app.\n- 📡 **Call Lua functions from Dart** and vice versa.\n- 🔌 **Register custom Dart functions** and expose them to Lua.\n- 📦 **Extend runtime behavior** with user-provided scripts.\n- 🧩 Optional **extension layer (`LuaExtension`)** for organizing reusable Lua helpers.\n\n---\n\n## 📦 Installation\n\nAdd to your `pubspec.yaml`:\n\n```yaml\ndependencies:\n  flutter_embed_lua: latest\n```\n\nThen run:\n\n```bash\nflutter pub get\n```\n\n---\n\n## 📃 Usage\n\n```dart\nimport 'dart:ffi';\nimport 'package:ffi/ffi.dart';\nimport 'package:flutter/material.dart';\n\nimport 'package:flutter_embed_lua/lua_bindings.dart';\nimport 'package:flutter_embed_lua/lua_runtime.dart';\nimport 'package:fluttertoast/fluttertoast.dart';\n\nvoid main() {\n  // ensure Initialized\n  WidgetsFlutterBinding.ensureInitialized();\n  runApp(LuaReplApp());\n}\n\nclass LuaReplApp extends StatefulWidget {\n  @override\n  State\u003cLuaReplApp\u003e createState() =\u003e _LuaReplAppState();\n}\n\nclass _LuaReplAppState extends State\u003cLuaReplApp\u003e {\n  final LuaRuntime runtime = LuaRuntime();\n  final TextEditingController controller = TextEditingController();\n  final List\u003cString\u003e output = [];\n\n  final showToastPtr = Pointer.fromFunction\u003cInt32 Function(Pointer\u003clua_State\u003e)\u003e(\n    _showToast,\n    0,\n  );\n\n  static int _showToast(Pointer\u003clua_State\u003e L) {\n    final bindings = LuaRuntime.lua;\n\n    final msgPtr = bindings.lua_tolstring(L, 1, nullptr);\n    final msg = msgPtr.cast\u003cUtf8\u003e().toDartString();\n\n    Fluttertoast.showToast(\n      msg: msg,\n      toastLength: Toast.LENGTH_SHORT,\n      gravity: ToastGravity.TOP,\n      timeInSecForIosWeb: 1,\n      backgroundColor: const Color.fromARGB(255, 204, 204, 204),\n      textColor: const Color.fromARGB(255, 0, 0, 0),\n      fontSize: 16.0,\n    );\n    return 0; // number of return values\n  }\n\n  void runCode() {\n    final code = controller.text;\n    final result = runtime.run(code);\n    setState(() {\n      output.add(\"\u003e $code\\n$result\");\n    });\n    controller.clear();\n  }\n\n  @override\n  void dispose() {\n    runtime.dispose();\n    super.dispose();\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    runtime.registerFunction(\"showToast\", showToastPtr);\n\n    return MaterialApp(\n      home: Scaffold(\n        appBar: AppBar(title: Text(\"Lua REPL\")),\n        body: Column(\n          children: [\n            Expanded(\n              child: ListView.builder(\n                itemCount: output.length,\n                itemBuilder: (context, i) =\u003e Padding(\n                  padding: const EdgeInsets.all(4),\n                  child: Text(\n                    output[i],\n                    style: TextStyle(fontFamily: 'monospace'),\n                  ),\n                ),\n              ),\n            ),\n            Row(\n              children: [\n                Expanded(\n                  child: TextField(\n                    controller: controller,\n                    onSubmitted: (_) =\u003e runCode(),\n                    decoration: InputDecoration(hintText: \"Enter Lua code\"),\n                  ),\n                ),\n                IconButton(icon: Icon(Icons.send), onPressed: runCode),\n              ],\n            ),\n          ],\n        ),\n      ),\n    );\n  }\n}\n```\n\n---\n\n## 📚 Classes Overview\n\n**LuaRuntime**\n\n**-run(String code)** → Runs Lua code.\n\n**-registerFunction(String name, Function function)** → Exposes a Dart function to Lua.\n\n---\n\n# 🤝 Contributing\n\nContributions are welcome!\n\nIf you’d like to improve this plugin, feel free to open an issue or a pull request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F04ar%2Fflutter_embed_lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F04ar%2Fflutter_embed_lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F04ar%2Fflutter_embed_lua/lists"}