https://github.com/tongson/LadyLua Skip to content Sign up Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Project management - + Integrations - + GitHub Sponsors - + Customer stories- * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Education - [ ] [search-key] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up Sign up {{ message }} tongson / LadyLua * Notifications * Star 41 * Fork 1 Single executable(static), batteries included, Lua 5.1 interpreter. MIT License 41 stars 1 fork Star Notifications * Code * Issues 1 * Pull requests 0 * Actions * Projects 1 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights main Switch branches/tags [ ] Branches Tags Nothing to show {{ refName }} default View all branches Nothing to show {{ refName }} default View all tags 1 branch 3 tags Go to file Code Clone HTTPS GitHub CLI [https://github.com/t] Use Git or checkout with SVN using the web URL. [gh repo clone tongso] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio If nothing happens, download the GitHub extension for Visual Studio and try again. Go back Latest commit @tongson tongson Forgot these modules. ... 8f2ed1b Apr 8, 2021 Forgot these modules. 8f2ed1b Git stats * 261 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .lib Mark start of command. Apr 5, 2021 bench bench: Object access benchmark. Apr 2, 2021 bugs bugs: Not really bugs but corner cases. Might be a problem with gener... Apr 1, 2021 docs Credit original source of text. Apr 8, 2021 examples First example for table.find. Apr 6, 2021 external logger: Import loguago source. Apr 2, 2021 licenses Merge with some of luassert code(MIT licensed). Apr 3, 2021 lua Needs the resource level. Apr 7, 2021 scripts Add headers to tables. Apr 8, 2021 tests Credit original source of text. Apr 8, 2021 .gitignore ignore this directory. Apr 6, 2021 LICENSE Initial commit Mar 29, 2021 README.adoc Forgot these modules. Apr 8, 2021 exec.go chore: go fmt exec.go. Apr 1, 2021 fs.go Follow Lua and lfs convention. Return nil plus an error message. Apr 5, 2021 global.go chore: go fmt. Mar 30, 2021 go.mod html: Wrapper for github.com/microcosm-cc/bluemonday. Only sanitize f... Apr 3, 2021 go.sum html: Wrapper for github.com/microcosm-cc/bluemonday. Only sanitize f... Apr 3, 2021 html.go html: Wrapper for github.com/microcosm-cc/bluemonday. Only sanitize f... Apr 3, 2021 lib.go Sync with rr/lib. Apr 6, 2021 ll.go Next release is 0.3.0. Apr 8, 2021 ll.svg readme: Public domain SVG. Apr 3, 2021 ll.toml Selene configuration. Apr 5, 2021 os.go ll: Actual initial commit of code. Mar 30, 2021 selene.toml Selene configuration. Apr 5, 2021 test.lua Move os tests and generate docs. Apr 8, 2021 uid.go Add prefix to avoid collisions. Apr 3, 2021 View code LadyLua Why? Reference Compiled-in modules Documentation and Testing Ideas Statistics and numbers Benchmark README.adoc LadyLua Single static executable, batteries-included, Lua 5.1 interpreter. A fat GopherLua amalgamation of modules in Go and Lua. Table of Contents * Why? * Reference * Compiled-in modules * Documentation and Testing * Ideas * Statistics and numbers * Benchmark [ll] Why? Lua is a good language but no one wants to use it for general-purpose scripting. Complaints are 1-based indexing and missing libraries. The latter is a valid concern. The 5.2+ split also does not help. I was convinced that GopherLua would be a good base for a kitchen-sink interpreter. Writing wrappers for the vast selection of Go packages would be a breeze. Reference Since GopherLua is an implementation of Lua 5.1, you can use the official Lua 5.1 reference manual: Lua 5.1 Manual. Other resources are also useful just make sure they do not target 5.2+ versions. Search for PDFs of Lua 5.1 cheatsheets. The Learn in in 15 minutes series also has an entry for Lua. Compiled-in modules Module Global Source License crypto N gluacrypto MIT exec Y MIT fmt Y MIT fs Y gopher-lfs Unlicense html N MIT http N gluahttp MIT inspect N inspect MIT json N gopher-json Unlicense kapow N MIT template N etlua MIT test N u-test MIT uid N MIT [?] If it says N in the Global field, you need to require() it. [?] Check the docs directory for more information about these modules. Documentation and Testing Tests are in the tests directory. We are using u-test. Within the test code is the documentation in AsciiDoc. Generated docs are in the docs directory. Check the scripts/docs directory for the command line to generate the docs. Ideas Besides general purpose scripting, a more specific use for me right now is using Lua for writing web apps. You can write it dynamic style like PHP but instead you have Lua. Another idea is hooking Go packages that interface with DevOps things. Instead of YAML you can program DevOps tools in Lua. Statistics and numbers Tests 114/114 Static executable bytes 7061504 Benchmark Wonder how it compares to PUC-Rio Lua 5.1.5 and LuaJIT2? Here's a benchmark for object access time. Check the bench/ directory for the code. The results are from the default 100M runs. GopherLua is fast enough for unconvoluted work. It also demonstrates that LuaJIT is too smart for these benchmarks. Table 1. GopherLua 72.804599166 Standard (solid) 85.15575082900001 Standard (metatable) 76.84095142800001 Object using closures (PiL 16.4) 56.77138606499997 Object using closures (noself) 54.96075333699997 Direct Access 32.508254155999964 Local Variable Table 2. Lua 5.1.5 12.906285 Standard (solid) 13.649843 Standard (metatable) 13.294447 Object using closures (PiL 16.4) 9.024326 Object using closures (noself) 5.618169 Direct Access 1.76135 Local Variable Table 3. LuaJIT 2.1 0.200721 Standard (solid) 0.200649 Standard (metatable) 0.200672 Object using closures (PiL 16.4) 0.200635 Object using closures (noself) 0.200627 Direct Access 0.200628 Local Variable Before you go disabling function inlining to reduce the executable size; here are the benchmarks for it. Table 4. GopherLua (disabled function inlining) 97.82842299 Standard (solid) 117.51864293899999 Standard (metatable) 103.283447037 Object using closures (PiL 16.4) 66.51865570900003 Object using closures (noself) 69.64288394199997 Direct Access 37.33177725300004 Local Variable About Single executable(static), batteries included, Lua 5.1 interpreter. Topics lua scripting Resources Readme License MIT License Releases 3 Veggie Expediter Latest Apr 8, 2021 + 2 releases Packages 0 No packages published Languages * Lua 87.3% * Go 12.5% * Shell 0.2% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.