{"id":21404012,"url":"https://github.com/tinybiggames/plua","last_synced_at":"2025-07-13T22:32:27.307Z","repository":{"id":263927851,"uuid":"891805036","full_name":"tinyBigGAMES/PLUA","owner":"tinyBigGAMES","description":"Lua for Pascal","archived":false,"fork":false,"pushed_at":"2024-11-21T02:34:51.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-21T03:24:00.299Z","etag":null,"topics":["delphi","embedded","lua","luajit","pascal","win64","windows-10","windows-11"],"latest_commit_sha":null,"homepage":"","language":null,"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/tinyBigGAMES.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"tinyBigGAMES","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"thanks_dev":null,"custom":null}},"created_at":"2024-11-21T01:35:41.000Z","updated_at":"2024-11-21T02:38:48.000Z","dependencies_parsed_at":"2024-11-21T03:36:19.167Z","dependency_job_id":null,"html_url":"https://github.com/tinyBigGAMES/PLUA","commit_stats":null,"previous_names":["tinybiggames/plua"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyBigGAMES%2FPLUA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyBigGAMES%2FPLUA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyBigGAMES%2FPLUA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinyBigGAMES%2FPLUA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinyBigGAMES","download_url":"https://codeload.github.com/tinyBigGAMES/PLUA/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225925618,"owners_count":17546276,"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":["delphi","embedded","lua","luajit","pascal","win64","windows-10","windows-11"],"created_at":"2024-11-22T16:12:02.504Z","updated_at":"2024-11-22T16:12:03.391Z","avatar_url":"https://github.com/tinyBigGAMES.png","language":null,"readme":"![PLUS](media/plua.png)  \n[![Chat on Discord](https://img.shields.io/discord/754884471324672040?style=for-the-badge)](https://discord.gg/tPWjMwK)\n[![Follow on Bluesky](https://img.shields.io/badge/Bluesky-tinyBigGAMES-blue?style=for-the-badge\u0026logo=bluesky)](https://bsky.app/profile/tinyBigGAMES.bsky.social)\n\nPLUA is a lightweight and powerful 📦 that integrates LuaJIT scripting into \u003ca href=\"https://www.embarcadero.com/products/delphi\" target=\"_blank\"\u003eDelphi\u003c/a\u003e, enabling you to easily add a scripting layer to your Delphi apps. Whether you're building dynamic software 🖥️, adding mod support 🛠️, or simply looking for a way to make your apps more flexible and customizable, PLUA makes this possible through simple, straightforward APIs.\n\n## 📑 Table of Contents\n- [📘 Introduction](#introduction)\n- [✨ Key Features](#key-features)\n- [🔧 Potential Uses](#potential-uses)\n- [🚀 Getting Started](#getting-started)\n- [📥 Installation](#installation)\n- [📄 Usage Examples](#usage-examples)\n- [⚙️ Advanced Features](#advanced-features)\n- [📚 API Overview](#api-overview)\n- [🤝 Contributing](#contributing)\n- [📜 License](#license)\n\n## Introduction\nPLUA offers a bridge 🌉 between Delphi and LuaJIT, providing a powerful scripting solution to extend the capabilities of your Delphi projects. With PLUA, Delphi developers can enjoy all the benefits of embedding a dynamic, fast ⚡, and easy-to-use scripting language like Lua, while leveraging LuaJIT for high performance 🏎️.\n\nThis library is designed to make integrating Lua into Delphi applications as seamless as possible, focusing on usability, efficiency, and a minimal learning curve 📈. All dependencies are compiled directly into the executable, eliminating the need for external DLLs and making deployment simpler and more reliable ✅.\n\n## Key Features\n- **Blazing Fast Performance** ⚡: Built on LuaJIT, PLUA provides exceptional speed, making it suitable for performance-critical applications.\n- **Simple APIs** 📜: Easy-to-use API for registering Delphi routines and executing Lua scripts.\n- **Seamless Interoperability** 🔄: Effortlessly pass data between Delphi and Lua environments.\n- **Interactive Debugging** 🐞: Use `dbg()` in your Lua scripts to start interactive debugging.\n- **Custom Routine Registration** ➕: Easily add custom routines in Delphi that Lua scripts can call.\n- **Minimal Setup** 🛠️: Requires only a few lines of code to get started.\n- **Script Importing and Bundling** 📦: Use a custom `import` command to combine scripts, compile them into a single file, and optionally store them as an EXE resource for a fully self-contained application.\n- **No External Dependencies** 🚫📦: All dependencies are compiled directly into the EXE, so there are no external DLLs to maintain.\n\n## Potential Uses\n- **Add Modding Support** 🛠️: Enhance your applications by allowing users to create mods.\n- **Dynamic Workflows** 🔄: Create flexible workflows with scriptable business logic.\n- **Runtime Flexibility** ⏱️: Offload logic to Lua scripts to modify behavior at runtime.\n- **Game Development** 🎮: Build games or simulation engines with a powerful scripting layer.\n\n## Getting Started\nThis section will help you get PLUA up and running in your Delphi environment.\n\n### Prerequisites\n- **Delphi 12 CE or higher** 🖥️\n- **Windows 10 or higher** 🪟\n- **Tested on Windows 11 64-bit (23H2), Delphi 12.2** ✅\n\n### Installation\n1. Clone or download the PLUA repository 📂.\n2. Add the PLUA source files to your Delphi project.\n\n1. 📥 Download the latest version of [PLUA](https://github.com/tinyBigGAMES/PLUA/archive/refs/heads/main.zip).\n2. 📂 Extract the contents to your project directory.\n3. ➕ Add the **PLUA** `src` folder to your **Library Path** in Delphi.\n4. 📝 In your project, include `PLUA` in the `uses` clause. To leverage the extensions, add `PLUA.Ext` after `PLUA` in the `uses` clause.\n5. 📁 Refer to the `examples` folder for detailed usage instructions and demonstrations of the PSFML library in action.\n\nThat's it! You should now be able to start scripting with Lua in your Delphi projects 🚀.\n\n## Usage Examples\nHere are some simple examples to demonstrate how to integrate PLUA into your Delphi project:\n\n### Loading and Running Lua Scripts 🐍\n```pascal\nvar\n  Lua: TLua;\nbegin\n  Lua := TLua.Create();\n  Lua.LoadString('print(\"Hello from Lua!\")', False);\n  Lua.Run();  \n  Lua.Free();\nend;\n```\n\n### Registering a Delphi Routine to be Used in Lua 🔗\n```pascal\nprocedure MyDelphiRoutine(ALua: ILuaContext);\nbegin\n  // Example routine that pushes a string result onto Lua stack\n  ALua.PushValue('Hello from Delphi!');\nend;\n\nvar\n  Lua: TLua;\nbegin\n  Lua := TLua.Create();\n  Lua.RegisterRoutine('DelphiRoutine', MyDelphiRoutine);\n  Lua.LoadString('DelphiRoutine()', False);\n  Lua.Run();\n  Lua.Free();\nend;\n```\n\n### Calling Lua Functions from Delphi 🔁\n```pascal\nvar\n  Lua: TLua;\n  Result: TLuaValue;\nbegin\n  Lua := TLua.Create();\n  Lua.LoadString('function greet() return \"Hello from Lua!\" end');\n  Result := Lua.Call('greet', []);\n  ShowMessage(Result.AsString);  \n  Lua.Free();\nend;\n```\n\n## Advanced Features\nPLUA also supports advanced features like:\n\n- **Interactive Debugging** 🐞: Add `dbg()` in Lua code to begin debugging, useful for identifying issues during runtime.\n- **Script Importing** 📂: Use `import` to bundle various script files into a single compilation unit, which is useful for saving and loading compiled scripts as resources.\n- **Bytecode Compilation** 📄: Compile Lua scripts to bytecode using `CompileToStream()`, allowing efficient packaging and distribution.\n\n## API Overview\nThe PLUA API has been designed to be both powerful and easy to use. Below is a quick reference to key classes and methods:\n\n### TLua 🐍\n- **Create/Destroy** ✨: Manage the lifecycle of the Lua instance.\n- **LoadStream/LoadString/LoadFile** 📥: Load Lua scripts from various sources.\n- **Run** ▶️: Execute the loaded script.\n- **Call** 📞: Call a Lua function from Delphi.\n- **RegisterRoutine** ➕: Register Delphi routines to be callable from Lua.\n\n### ILuaContext 🌐\n- **PushValue/GetValue** 🔄: Push values to or get values from the Lua stack.\n- **ClearStack/PopStack** 🗑️: Manage stack states effectively.\n- **SetTableFieldValue/GetTableFieldValue** 🧩: Access and manipulate Lua tables.\n\n### Contributing\n\nContributions to **PLUA** are highly encouraged. Please feel free to submit issues, suggest new features, or create pull requests to expand the capabilities and robustness of the scripting engine.\n\n### License\n\n**PLUA** is distributed under the 🆓 **BSD-3-Clause License**, allowing for redistribution and use in both source and binary forms, with or without modification, under specific conditions. See the [LICENSE](https://github.com/tinyBigGAMES/PLUA?tab=BSD-3-Clause-1-ov-file#BSD-3-Clause-1-ov-file) file for more details.\n\n### Support\n\n- \u003ca href=\"https://github.com/tinyBigGAMES/PLUA/issues\" target=\"_blank\"\u003eIssues\u003c/a\u003e\n- \u003ca href=\"https://github.com/tinyBigGAMES/PLUA/discussions\" target=\"_blank\"\u003eDiscussions\u003c/a\u003e\n- \u003ca href=\"https://learndelphi.org/\" target=\"_blank\"\u003eLearn Delphi\u003c/a\u003e\n---\nWe hope PLUA helps make your Delphi projects more dynamic and flexible. Happy coding! 💻🎉\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"media/delphi.png\" alt=\"Delphi\"\u003e\n\u003c/p\u003e\n\u003ch5 align=\"center\"\u003e\n\nMade with :heart: in Delphi\n\u003c/h5\u003e\n\n","funding_links":["https://github.com/sponsors/tinyBigGAMES"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinybiggames%2Fplua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinybiggames%2Fplua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinybiggames%2Fplua/lists"}