luaa: add support for conffile in index

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-11-13 15:11:37 +01:00
parent 590077004a
commit 292f09bb93
3 changed files with 8 additions and 15 deletions

View File

@ -17,6 +17,7 @@ client
color color
Control Control
coords coords
conffile
Ctrl Ctrl
east east
ellipsize ellipsize

View File

@ -128,7 +128,7 @@ end
-- If it's not ok, the error will be returned. -- If it's not ok, the error will be returned.
-- @return Never return if awesome restart, or return a string error. -- @return Never return if awesome restart, or return a string error.
function restart() function restart()
local c = checkfile(capi.awesome.conffile()) local c = checkfile(capi.awesome.conffile)
if type(c) ~= "function" then if type(c) ~= "function" then
return c return c

20
luaa.c
View File

@ -166,19 +166,6 @@ luaA_font_set(lua_State *L)
return 0; return 0;
} }
/** Get configuration file path used by awesome.
* \param L The Lua VM state.
* \return The number of elements pushed on stack.
* \luastack
* \lreturn The awesome configuration file path.
*/
static int
luaA_conffile(lua_State *L)
{
lua_pushstring(L, globalconf.conffile);
return 1;
}
/** Set default colors. /** Set default colors.
* \param L The Lua VM state. * \param L The Lua VM state.
* \return The number of elements pushed on stack. * \return The number of elements pushed on stack.
@ -748,6 +735,9 @@ luaA_mouse_add(lua_State *L)
/** awesome global table. /** awesome global table.
* \param L The Lua VM state. * \param L The Lua VM state.
* \return The number of elements pushed on stack. * \return The number of elements pushed on stack.
* \luastack
* \lfield font The default font.
* \lfield conffile The configuration file which has been loaded.
*/ */
static int static int
luaA_awesome_index(lua_State *L) luaA_awesome_index(lua_State *L)
@ -767,6 +757,9 @@ luaA_awesome_index(lua_State *L)
g_free(font); g_free(font);
} }
break; break;
case A_TK_CONFFILE:
lua_pushstring(L, globalconf.conffile);
break;
default: default:
return 0; return 0;
} }
@ -831,7 +824,6 @@ luaA_init(void)
{ "font_set", luaA_font_set }, { "font_set", luaA_font_set },
{ "colors_set", luaA_colors_set }, { "colors_set", luaA_colors_set },
{ "colors", luaA_colors }, { "colors", luaA_colors },
{ "conffile", luaA_conffile },
{ "__index", luaA_awesome_index }, { "__index", luaA_awesome_index },
{ "__newindex", luaA_awesome_newindex }, { "__newindex", luaA_awesome_newindex },
/* deprecated */ /* deprecated */