[lua] Split luaA_parserc into luaA_init/parserc
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
35d1bc283f
commit
4af0791499
15
awesome.c
15
awesome.c
|
@ -361,12 +361,6 @@ main(int argc, char **argv)
|
|||
xcolor_new(globalconf.connection, globalconf.default_screen, "black", &globalconf.colors.fg);
|
||||
xcolor_new(globalconf.connection, globalconf.default_screen, "white", &globalconf.colors.bg);
|
||||
|
||||
/* parse config */
|
||||
if(!confpath)
|
||||
confpath = config_file();
|
||||
if (!luaA_parserc(confpath))
|
||||
eprint("failed to load/parse configuration file %s", confpath);
|
||||
|
||||
/* init cursors */
|
||||
globalconf.cursor[CurNormal] = xutil_cursor_new(globalconf.connection, CURSOR_LEFT_PTR);
|
||||
globalconf.cursor[CurResize] = xutil_cursor_new(globalconf.connection, CURSOR_SIZING);
|
||||
|
@ -378,6 +372,15 @@ main(int argc, char **argv)
|
|||
globalconf.cursor[CurBotRight] = xutil_cursor_new(globalconf.connection, CURSOR_BOTTOM_RIGHT_CORNER);
|
||||
globalconf.cursor[CurBotLeft] = xutil_cursor_new(globalconf.connection, CURSOR_BOTTOM_LEFT_CORNER);
|
||||
|
||||
/* init lua */
|
||||
luaA_init();
|
||||
|
||||
/* parse config */
|
||||
if(!confpath)
|
||||
confpath = config_file();
|
||||
if (!luaA_parserc(confpath))
|
||||
eprint("failed to load/parse configuration file %s", confpath);
|
||||
|
||||
/* select for events */
|
||||
const uint32_t change_win_vals[] =
|
||||
{
|
||||
|
|
22
lua.c
22
lua.c
|
@ -402,11 +402,12 @@ luaA_openlib(lua_State *L, const char *name,
|
|||
luaL_register(L, name, methods);
|
||||
}
|
||||
|
||||
bool
|
||||
luaA_parserc(const char *rcfile)
|
||||
/** Initialize the Lua VM
|
||||
*/
|
||||
void
|
||||
luaA_init(void)
|
||||
{
|
||||
lua_State *L;
|
||||
int screen;
|
||||
|
||||
static const struct luaL_reg awesome_lib[] =
|
||||
{
|
||||
|
@ -480,10 +481,21 @@ luaA_parserc(const char *rcfile)
|
|||
lua_settable(L, LUA_GLOBALSINDEX);
|
||||
|
||||
luaA_dostring(L, "package.path = package.path .. \";" AWESOME_LUA_LIB_PATH "/?.lua\"");
|
||||
}
|
||||
|
||||
if(luaL_dofile(L, rcfile))
|
||||
/** Load a configuration file
|
||||
*
|
||||
* \param rcfile The configuration file to load.
|
||||
* \return True on succes, false on failure.
|
||||
*/
|
||||
bool
|
||||
luaA_parserc(const char* rcfile)
|
||||
{
|
||||
fprintf(stderr, "%s\n", lua_tostring(L, -1));
|
||||
int screen;
|
||||
|
||||
if(luaL_dofile(globalconf.L, rcfile))
|
||||
{
|
||||
fprintf(stderr, "%s\n", lua_tostring(globalconf.L, -1));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue