X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=lib-lua%2Fruntime.c;h=a442401f6f06eb9b8f4184e118c72ca5de7849ed;hp=8788ed5848cc608b756b22737116beb81c4baab8;hb=3132c5f07ae687b5daac6b570347369967850863;hpb=88d22daa9c1316d5ccc4b4bb60d40cc96c767757 diff --git a/lib-lua/runtime.c b/lib-lua/runtime.c index 8788ed5..a442401 100644 --- a/lib-lua/runtime.c +++ b/lib-lua/runtime.c @@ -66,3 +66,18 @@ int mlua_wrap(void (*errfun)(const char *fmt, ...), int status) return status; } +ssize_t mlua_value(char *buf, ssize_t len, + const char *table, const char *key) +{ + ssize_t res; + + lua_getglobal(L, table); + lua_pushstring(L, key); + lua_gettable(L, -2); + res = m_strcpy(buf, len, lua_tostring(L, -1)); + lua_remove(L, -1); + lua_remove(L, -1); + + return res; +} +