Skip to content

Commit

Permalink
Re-add table lib for COLORLCD
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelcoeffic committed Feb 9, 2023
1 parent c435f8a commit e1b346f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
11 changes: 9 additions & 2 deletions radio/src/thirdparty/Lua/src/linit.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ extern LROT_TABLE(lcdlib);
extern LROT_TABLE(modellib);
extern LROT_TABLE(bitmaplib);

#if defined(COLORLCD)
extern LROT_TABLE(tablib);
#endif

/* _G __index -> rotables __index -> _index_hook_fct */
extern LROT_TABLE(rotables_meta);
extern LROT_TABLE(base_func);
Expand Down Expand Up @@ -94,6 +98,9 @@ LROT_BEGIN(rotables, LROT_TABLEREF(rotables_meta), 0)
LROT_TABENTRY( model, modellib )
LROT_TABENTRY( bitmap, bitmaplib )
LROT_TABENTRY( Bitmap, bitmaplib ) /* TODO: obsolete after 2.9 */
#if defined(COLORLCD)
LROT_TABENTRY( table, tablib )
#endif
LROT_TABENTRY( ROM, rotables )
LROT_END(rotables, LROT_TABLEREF(rotables_meta), 0)

Expand All @@ -103,10 +110,10 @@ LROT_BEGIN(lua_libs, NULL, 0)
LROT_FUNCENTRY( dir, luaopen_etxdir )
LROT_FUNCENTRY( bitmap_mt, luaopen_bitmap )
#if defined(LUA_ENABLE_LOADLIB)
LROT_FUNCENTRY( package, luaopen_package )
LROT_FUNCENTRY( package, luaopen_package )
#endif
#if defined(LUA_ENABLE_STRLIB_MT)
LROT_FUNCENTRY( string, luaopen_string )
LROT_FUNCENTRY( string, luaopen_string )
#endif
LROT_END(lua_libs, NULL, 0)

Expand Down
31 changes: 12 additions & 19 deletions radio/src/thirdparty/Lua/src/ltablib.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
** See Copyright Notice in lua.h
*/

#define ltablib_c
#define LUA_LIB

#include <stddef.h>

#define ltablib_c

#include "lua.h"

#include "lauxlib.h"
Expand Down Expand Up @@ -256,27 +256,20 @@ static int sort (lua_State *L) {
/* }====================================================== */


const luaL_Reg tab_funcs[] = {
{"concat", tconcat},
LROT_BEGIN(tablib, NULL, 0)
LROT_FUNCENTRY( concat, tconcat)
#if defined(LUA_COMPAT_MAXN)
{"maxn", maxn},
LROT_FUNCENTRY( maxn, maxn)
#endif
{"insert", tinsert},
{"pack", pack},
{"unpack", unpack},
{"remove", tremove},
{"sort", sort},
{NULL, NULL}
};
LROT_FUNCENTRY( insert, tinsert)
LROT_FUNCENTRY( pack, pack)
LROT_FUNCENTRY( unpack, unpack)
LROT_FUNCENTRY( remove, tremove)
LROT_FUNCENTRY( sort, sort)
LROT_END(tablib, NULL, 0)


LUAMOD_API int luaopen_table (lua_State *L) {
luaL_newlib(L, tab_funcs);
#if defined(LUA_COMPAT_UNPACK)
/* _G.unpack = table.unpack */
lua_getfield(L, -1, "unpack");
lua_setglobal(L, "unpack");
#endif
return 1;
return 0;
}

0 comments on commit e1b346f

Please sign in to comment.