summaryrefslogtreecommitdiff
path: root/apps/plugins/lua
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/lua')
-rw-r--r--apps/plugins/lua/rocklib.c13
-rwxr-xr-xapps/plugins/lua/rocklib_aux.pl3
2 files changed, 16 insertions, 0 deletions
diff --git a/apps/plugins/lua/rocklib.c b/apps/plugins/lua/rocklib.c
index 54c2bc0c03..ed625ca369 100644
--- a/apps/plugins/lua/rocklib.c
+++ b/apps/plugins/lua/rocklib.c
@@ -472,6 +472,16 @@ RB_WRAP(create_numbered_filename)
472 return 1; 472 return 1;
473} 473}
474 474
475RB_WRAP(utf8encode)
476{
477 unsigned long ucs = (unsigned long) luaL_checkint(L, 1);
478 unsigned char tmp[9];
479 unsigned char *end = rb->utf8encode(ucs, tmp);
480 *end = '\0';
481 lua_pushstring(L, tmp);
482 return 1;
483}
484
475#define RB_FUNC(func) {#func, rock_##func} 485#define RB_FUNC(func) {#func, rock_##func}
476static const luaL_Reg rocklib[] = 486static const luaL_Reg rocklib[] =
477{ 487{
@@ -520,6 +530,9 @@ static const luaL_Reg rocklib[] =
520#if CONFIG_CODEC == SWCODEC 530#if CONFIG_CODEC == SWCODEC
521 RB_FUNC(pcm), 531 RB_FUNC(pcm),
522#endif 532#endif
533
534 RB_FUNC(utf8encode),
535
523 {NULL, NULL} 536 {NULL, NULL}
524}; 537};
525#undef RB_FUNC 538#undef RB_FUNC
diff --git a/apps/plugins/lua/rocklib_aux.pl b/apps/plugins/lua/rocklib_aux.pl
index f52c64e98b..f3705bf2d1 100755
--- a/apps/plugins/lua/rocklib_aux.pl
+++ b/apps/plugins/lua/rocklib_aux.pl
@@ -70,6 +70,9 @@ my @forbidden_functions = ('^open$',
70 '^s?+rand$', 70 '^s?+rand$',
71 '^strl?+cpy$', 71 '^strl?+cpy$',
72 '^strl?+cat$', 72 '^strl?+cat$',
73 '^iso_decode$',
74 '^utf8encode$',
75 '^utf16',
73 '^codec_', 76 '^codec_',
74 '^timer_', 77 '^timer_',
75 '^lcd_(mono_)?+bitmap', 78 '^lcd_(mono_)?+bitmap',