{"id":27946862,"url":"https://github.com/dmccuskey/dmc-lua-library","last_synced_at":"2025-06-28T09:33:56.851Z","repository":{"id":17238348,"uuid":"20007476","full_name":"dmccuskey/DMC-Lua-Library","owner":"dmccuskey","description":"a collection of awesome Lua modules","archived":false,"fork":false,"pushed_at":"2015-05-03T06:29:22.000Z","size":585,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-07T13:58:24.275Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"docs.davidmccuskey.com/dmc-lua-library","language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"DaoCloud/python-django-cd-sample","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dmccuskey.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-21T04:08:39.000Z","updated_at":"2023-07-06T20:59:33.000Z","dependencies_parsed_at":"2022-07-21T19:48:32.185Z","dependency_job_id":null,"html_url":"https://github.com/dmccuskey/DMC-Lua-Library","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmccuskey%2FDMC-Lua-Library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmccuskey%2FDMC-Lua-Library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmccuskey%2FDMC-Lua-Library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmccuskey%2FDMC-Lua-Library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmccuskey","download_url":"https://codeload.github.com/dmccuskey/DMC-Lua-Library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252892523,"owners_count":21820647,"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":[],"created_at":"2025-05-07T13:58:26.727Z","updated_at":"2025-05-07T13:58:27.190Z","avatar_url":"https://github.com/dmccuskey.png","language":"Lua","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DMC Lua Library #\n\nThis library repo is just the collection of Lua modules from my other repos, so it is just a convenient spot to get and update all of them.\n\nAll of the modules are actively used by me in building apps both on the server (using [Lua-Corovel](https://github.com/dmccuskey/lua-corovel)) and on mobile devices (using the Corona SDK).\n\n\n*Documentation*\n\nLimited documentation can be found in each of the corresponding repos and generally serves well for getting an overview of the module features. The majority of the documentation is found online at http://docs.davidmccuskey.com/\n\n\n*Tests*\n\nThe available unit tests are written using [Busted](https://github.com/Olivine-Labs/busted). Install using luarocks:\n\n`\u003e luarocks install busted`\n\nRun at the command line:\n\n`\u003e busted`\n\n\n## Current Modules ##\n\n* [json](#json)\n\n  A shim to load Lua `json` modules. [Read more...](#json)\n\n* [lua_bytearray](#lua_bytearray)\n\n  A Lua byte array module. [Read more...](#lua_bytearray)\n\n* [lua_e4x](#lua_e4x)\n\n  Pure Lua E4X XML parser. [Read more...](#lua_e4x)\n\n* [lua_error](#lua_error)\n\n  Better error handling for Lua. [Read more...](#lua_error)\n\n* [lua_events_mix](#lua_events_mix)\n\n  Mixin or monkey-patch event functionality to your objects. [Read more...](#lua_events_mix)\n\n* [lua_files](#lua_files)\n\n  File tasks, handling json, config files. [Read more...](#lua_files)\n\n* [lua_megaphone](#lua_megaphone)\n\n  In-app, global communication object. [Read more...](#lua_megaphone)\n\n* [lua_objects](#lua_objects)\n\n  Advanced OOP for Lua. [Read more...](#lua_objects)\n\n* [lua_patch](#lua_patch)\n\n  Patch Lua with Python-cool. [Read more...](#lua_patch)\n\n* [lua_promise](#lua_promise)\n\n  Deferreds and Promises for Lua. [Read more...](#lua_promise)\n\n* [lua_states_mix](#lua_states_mix)\n\n  Mixin or monkey-patch State Machine functionality to your objects. [Read more...](#lua_states_mix)\n\n* [lua_utils](#lua_utils)\n\n  Miscellaneous utility functions. [Read more...](#lua_utils)\n\n\n\n\u003ca name=\"json\"\u003e\u003c/a\u003e\n### Module: json ###\n\nThis file is used to load any of the various Lua `json` modules, but standardize the name to `json`. Currently it searches for one of `dkjson`, `cjson` or `json`.\n\nOf course you will need to install one of the above for it to work. You can also edit the file to add your favorite json module.\n\n```\n\u003e luarocks install dkjson\n\u003e luarocks install lua-cjson\n```\n\n\n\n\u003ca name=\"lua_bytearray\"\u003e\u003c/a\u003e\n### Module: lua_bytearray ###\n\nCurrently this library contains two byte array modules – `lua_bytearray` and `bytearray`. The former is from another dev and contains methods for un/packing bytes into shorts, longs, etc. The latter currently only supports string-base read/writes. I currently use both in my projects, though I plan on joining the two.\n\nIf you want to use `lua_bytearray` then you need to install `lpack`:\n\n`\u003e luarocks install lpack`\n\n\n**Documentation**\n\nhttp://docs.davidmccuskey.com/display/docs/lua_bytearray.lua\n\n\n**Examples**\n\nThere are a lot of examples in the unit test file, `spec/lua_bytearray_spec.lua`.\n\n\n\n\u003ca name=\"lua_e4x\"\u003e\u003c/a\u003e\n### Module: lua_e4x ###\n\n`lua_e4x` is an implementation of E4X for sane XML navigation in Lua.\n\n\n**Documentation**\n\nhttp://docs.davidmccuskey.com/display/docs/lua_e4x.lua\n\n\n**Examples**\n\nThere are a lot of examples in the unit test file, `spec/lua_e4x_spec.lua`.\n\nThere is also a micro example on the documentation website.\n\n\n\n\u003ca name=\"lua_error\"\u003e\u003c/a\u003e\n### Module: lua_error ###\n\n`lua_error` contains an Error base class and several *global* methods (`try()`, `catch()` and `finally()`) used to create a decent error-handling framework similar to that of Python.\n\nAs seen in the example below, you can check for regular string-based errors or a custom error class.\n\n```lua\ntry{\n\tfunction()\n\t\tself:unregister( handler, params )\n\tend,\n\n\tcatch{\n\t\tfunction(e)\n\t\t\tif type(e)=='string' then\n\t\t\t\terror( e )\n\t\t\telseif e:isa( Error.ProtocolError ) then\n\t\t\t\tself:_bailout(){\n\t\t\t\t\tcode=WebSocket.CLOSE_STATUS_CODE_PROTOCOL_ERROR,\n\t\t\t\t\treason=\"WAMP Protocol Error\"\n\t\t\t\t}\n\t\t\telse\n\t\t\t\tself:_bailout{\n\t\t\t\t\tcode=WebSocket.CLOSE_STATUS_CODE_INTERNAL_ERROR,\n\t\t\t\t\treason=\"WAMP Internal Error\"\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\t},\n\n\tfinally{\n\t\tself:close()\n\t}\n}\n```\n\n\n**Documentation**\n\nhttp://docs.davidmccuskey.com/display/docs/lua_error.lua\n\n\n**Examples**\n\nNone yet\n\n\n\n\u003ca name=\"lua_files\"\u003e\u003c/a\u003e\n### Module: lua_files ###\n\n`lua_files` contains methods for reading and writing raw data, json, and configuration files.\n\n\n**Documentation**\n\nhttp://docs.davidmccuskey.com/display/docs/lua_files.lua\n\n\n**Examples**\n\nThere are a lot of examples in the unit test file, `spec/lua_files_spec.lua`.\n\n\n\n\u003ca name=\"lua_objects\"\u003e\u003c/a\u003e\n### Module: lua_objects ###\n\n`lua_objects` contains several methods and object classes which together form an object-oriented framework to use when programming in Lua.\n\nSome advanced features:\n* getters/setters\n* event dispatch/listeners\n* structured object setup/teardown\n\n\n**Documentation**\n\nhttp://docs.davidmccuskey.com/display/docs/lua_objects.lua\n\n\n**Examples**\n\nThere are a lot of examples in this library's modules and the `dmc-corona-library`.\n\n\n\n\u003ca name=\"lua_patch\"\u003e\u003c/a\u003e\n### Module: lua_patch ###\n\n`lua_patch` patches Lua with extra functionality, currently this is:\n\n* Python-style string formatting\n* Python-style table pop function\n\n\n**Documentation**\n\nhttp://docs.davidmccuskey.com/display/docs/lua_patch.lua\n\n\n**Examples**\n\nNone yet\n\n\n\n\u003ca name=\"lua_promise\"\u003e\u003c/a\u003e\n### Module: lua_promise ###\n\n`lua_promise` contains classes and methods to create and use Promises and Deferreds. This is somewhat of a port from Python Twisted.\n\n\n**Documentation**\n\nhttp://docs.davidmccuskey.com/display/docs/lua_promise.lua\n\n\n**Examples**\n\nNone yet\n\n\n\n\u003ca name=\"lua_states\"\u003e\u003c/a\u003e\n### Module: lua_states ###\n\n`lua_states` mixin adds functionality to Lua objects so they can implement the State Machine design pattern.\n\n\n**Documentation**\n\nhttp://docs.davidmccuskey.com/display/docs/lua_states.lua\n\n\n**Examples**\n\nThere are a lot of examples in the unit test file, `spec/lua_states_spec.lua`.\n\n\n\n\u003ca name=\"lua_utils\"\u003e\u003c/a\u003e\n### Module: lua_utils ###\n\nThis module is an ever-changing list of helpful utility functions. Ever-changing because, over time, some functions have been removed and put into their own modules, eg `lua_performance`. Here are some of the groupings at the moment:\n\n* Callback Functions - createObjectCallback(), getTransitionCompleteFunc()\n* Date Functions - calcTimeBreakdown()\n* Image Functions - imageScale()\n* String Functions - split(), stringFormatting()\n* Table Functions - destroy(), extend(), hasOwnProperty(), print(), propertyIn(), removeFromTable(), shuffle(), tableSize(), tableSlice(), tableLength()\n* Web Functions - urlDecode(), urlEncode(), parseQuery(), createQuery()\n\n\n**Documentation**\n\nhttp://docs.davidmccuskey.com/display/docs/lua_utils.lua\n\n\n**Examples**\n\nNone yet\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmccuskey%2Fdmc-lua-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmccuskey%2Fdmc-lua-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmccuskey%2Fdmc-lua-library/lists"}