2 -- ion/share/ioncore_ext.lua -- Ioncore Lua library
4 -- Copyright (c) Tuomo Valkonen 2004-2008.
6 -- See the included file LICENSE for details.
9 -- This is a slight abuse of the package.loaded variable perhaps, but
10 -- library-like packages should handle checking if they're loaded instead of
11 -- confusing the user with require/includer differences.
12 if package.loaded["ioncore"] then return end
18 -- Maximum number of bytes to read from pipes
19 ioncore.RESULT_DATA_LIMIT=1024^2
21 -- Bindings, winprops, hooks, menu database and extra commands
22 dopath('ioncore_luaext')
23 dopath('ioncore_bindings')
24 dopath('ioncore_winprops')
25 dopath('ioncore_misc')
27 dopath('ioncore_menudb')
28 dopath('ioncore_tabnum')
29 dopath('ioncore_quasiact')
31 -- Modifier setup compatibility kludge
34 local function getmod(t, s)
36 return rawget(t, "MOD1") or "Mod1+"
38 return rawget(t, "META") or "Mod1+"
39 elseif s=="ALTMETA" then
40 return rawget(t, "MOD2") or ""
42 return rawget(t, "ALTMETA") or ""
48 local oldmeta, newmeta=getmetatable(_G), {}
50 newmeta=table.copy(oldmeta)
51 oldindex=oldmeta.__index
53 newmeta.__index=getmod
54 setmetatable(_G, newmeta)
56 -- Export some important functions into global namespace.
78 -- Mark ourselves loaded.
79 package.loaded["ioncore"]=true
83 local function dummy_gettext_hack()
84 -- Extra translations for context menus etc. I don't want extra
85 -- TR calls in the configuration files, or parsing the string
86 -- parameters to kpress etc. for translations.