{"id":13578178,"url":"https://github.com/siffiejoe/lua-rotable","last_synced_at":"2026-03-15T16:38:58.429Z","repository":{"id":147352842,"uuid":"105443264","full_name":"siffiejoe/lua-rotable","owner":"siffiejoe","description":"Save memory with custom module \"tables\"","archived":false,"fork":false,"pushed_at":"2017-10-31T14:01:05.000Z","size":7,"stargazers_count":24,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-05T15:49:27.495Z","etag":null,"topics":["c-api","embedded","lua","modules"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/siffiejoe.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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-10-01T13:15:46.000Z","updated_at":"2024-03-05T07:21:22.000Z","dependencies_parsed_at":"2023-07-02T16:46:28.261Z","dependency_job_id":null,"html_url":"https://github.com/siffiejoe/lua-rotable","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siffiejoe%2Flua-rotable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siffiejoe%2Flua-rotable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siffiejoe%2Flua-rotable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/siffiejoe%2Flua-rotable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/siffiejoe","download_url":"https://codeload.github.com/siffiejoe/lua-rotable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247366377,"owners_count":20927499,"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":["c-api","embedded","lua","modules"],"created_at":"2024-08-01T15:01:28.200Z","updated_at":"2025-12-27T15:03:51.345Z","avatar_url":"https://github.com/siffiejoe.png","language":"C","readme":"#                               rotable                              #\n\nTables in Lua use quite some dynamic memory. To reduce this memory\nconsumption on small embedded microcontrollers the [eLua project][1]\nintroduced `rotable`s (read-only tables) that can be stored in ROM and\nbehave mostly like ordinary Lua tables (except that you can't mutate\nthem, of course). These `rotable`s are particularly useful for module\ntables which usually don't change anyway and mostly contain strings as\nkeys and C function pointers as values.\n\nThis project provides a limited imitation of eLua's `rotable`s without\nthe need to patch Lua. On the plus side, more recent Lua versions (5.2\nand 5.3) are supported. The other features of eLua's [Lua Tiny RAM\npatch][2] and the [Emergency GC patch][3] have been [incorporated in\nrecent Lua versions][4] anyway.\n\n\n##                                API                               ##\n\n    /*  [-0, +1, m]  */\n    void rotable_newlib( lua_State* L, luaL_Reg const l[] );\n\nThis function creates and pushes a `rotable` onto the Lua stack. If\nyou don't have the auxiliary library available, you can use the type\n`rotable_Reg` instead of `luaL_Reg` in the above signature. A\n`rotable` is a small userdata (so you *do* have some dynamic memory\nallocation per `rotable`) that contains a pointer to the given\n`luaL_Reg` array and behaves mostly like a table. If the string keys\nin the `luaL_Reg` array are sorted lexicographically in ascending\norder (which is highly recommended), access is more efficient because\na binary search is used. Otherwise every access uses a linear search\nfor the key.\n\nIn contrast to the original `rotable`s in the eLua project, this\nimplementation only supports string keys and C function values. If you\nneed anything else, you can consider using a `rotable` as fallback\nusing an `__index` metamethod on a normal table.\n\n\n    /*  [-0, +1, m]  */\n    void rotable_newidx( lua_State* L, luaL_Reg const l[] );\n\nSince userdata values can't be used as `__index` meta methods, this\nfunction creates and pushes a custom C closure that looks up keys in\nthe given `luaL_Reg` array. It can be used as `__index` meta method\ninstead.\n\n\n##                              License                             ##\n\n**rotable** is *copyrighted free software* distributed under the MIT\nlicense (the same license as Lua 5.1). The full license text follows:\n\n    rotable (c) 2017 Philipp Janda\n\n    Permission is hereby granted, free of charge, to any person obtaining\n    a copy of this software and associated documentation files (the\n    \"Software\"), to deal in the Software without restriction, including\n    without limitation the rights to use, copy, modify, merge, publish,\n    distribute, sublicense, and/or sell copies of the Software, and to\n    permit persons to whom the Software is furnished to do so, subject to\n    the following conditions:\n\n    The above copyright notice and this permission notice shall be\n    included in all copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\n    IN NO EVENT SHALL THE AUTHOR OR COPYRIGHT HOLDER BE LIABLE FOR ANY\n    CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\n    TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n    SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n\n  [1]:  http://www.eluaproject.net/\n  [2]:  http://www.eluaproject.net/doc/v0.9/en_arch_ltr.html\n  [3]:  http://www.eluaproject.net/doc/v0.9/en_elua_egc.html\n  [4]:  http://www.lua.org/manual/5.2/readme.html#changes\n\n","funding_links":[],"categories":["C"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiffiejoe%2Flua-rotable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsiffiejoe%2Flua-rotable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsiffiejoe%2Flua-rotable/lists"}