1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
$NetBSD: patch-am,v 1.1 2006/08/14 22:40:53 wiz Exp $
--- share/ioncorelib.lua.orig 2004-02-16 17:58:47.000000000 +0000
+++ share/ioncorelib.lua
@@ -9,10 +9,10 @@
-- (at your option) any later version.
--
--- This is a slight abuse of the _LOADED variable perhaps, but library-like
+-- This is a slight abuse of the package.loaded variable perhaps, but library-like
-- packages should handle checking if they're loaded instead of confusing
-- the user with require/include differences.
-if _LOADED["ioncorelib"] then return end
+if package.loaded["ioncorelib"] then return end
-- Constants {{{
@@ -162,9 +162,9 @@ local winprops={}
local function alternative_winprop_idents(id)
local function g()
- for _, c in {id.class, "*"} do
- for _, r in {id.role, "*"} do
- for _, i in {id.instance, "*"} do
+ for _, c in pairs({id.class, "*"}) do
+ for _, r in pairs({id.role, "*"}) do
+ for _, i in pairs({id.instance, "*"}) do
coroutine.yield(c, r, i)
end
end
@@ -183,7 +183,7 @@ function get_winprop(cwin)
names={}
pcall(function() names=winprops[c][r][i] or {} end)
local match, matchl=names[0], 0
- for name, prop in names do
+ for name, prop in pairs(names) do
if type(name)=="string" then
local st, en=string.find(nm, name)
if st and en then
@@ -223,7 +223,7 @@ end
function winprop(list)
local list2, class, role, instance, name = {}, "*", "*", "*", 0
- for k, v in list do
+ for k, v in pairs(list) do
if k == "class" then
class = v
elseif k == "role" then
@@ -328,5 +328,5 @@ end
-- Mark ourselves loaded.
-_LOADED["ioncorelib"]=true
+package.loaded["ioncorelib"]=true
|