2 -- ion/share/ioncore_ext.lua -- Ioncore Lua library
4 -- Copyright (c) Tuomo Valkonen 2004-2007.
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')
30 -- Modifier setup compatibility kludge
33 local function getmod(t, s)
35 return rawget(t, "MOD1") or "Mod1+"
37 return rawget(t, "META") or "Mod1+"
38 elseif s=="ALTMETA" then
39 return rawget(t, "MOD2") or ""
41 return rawget(t, "ALTMETA") or ""
47 local oldmeta, newmeta=getmetatable(_G), {}
49 newmeta=table.copy(oldmeta)
50 oldindex=oldmeta.__index
52 newmeta.__index=getmod
53 setmetatable(_G, newmeta)
55 -- Export some important functions into global namespace.
77 -- Mark ourselves loaded.
78 package.loaded["ioncore"]=true
82 local function dummy_gettext_hack()
83 -- Extra translations for context menus etc. I don't want extra
84 -- TR calls in the configuration files, or parsing the string
85 -- parameters to kpress etc. for translations.