2 * \short LUA implementation
3 * \author Klaus Ethgen <Klaus@Ethgen.de>
7 * This file is a part of Geeqie project (http://geeqie.sourceforge.net/).
8 * Copyright (C) 2008 - 2010 The Geeqie Team
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
15 * This program is distributed in the hope that it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
33 #include "ui_fileops.h"
35 static lua_State *L; /** The LUA object needed for all operations (NOTE: That is
36 * a upper-case variable to match the documentation!) */
39 * \brief Initialize the lua interpreter.
44 luaL_openlibs(L); /* Open all libraries for lua programms */
48 * \brief Call a lua function to get a single value.
50 gchar *lua_callvalue(gchar *file, gchar *function)
59 result = luaL_dostring(L, function);
63 dir = g_build_filename(get_rc_dir(), "lua", NULL);
64 path = g_build_filename(dir, file, NULL);
65 result = luaL_dofile(L, path);
72 data = g_strdup_printf("Error running lua script: %s", lua_tostring(L, -1));
75 data = g_strdup(lua_tostring(L, -1));
80 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */