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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
From 86eb438ffb3580e6f7e82c17929d59c914dd46cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Peter=20Drahos=CC=8C?= <drahosp@gmail.com>
Date: Wed, 16 May 2012 10:40:55 +0200
Subject: [PATCH] Updated lua 5.2 compatibility
---
CMakeLists.txt | 2 +-
alt_getopt | 2 +-
alt_getopt.lua | 11 +++++++----
dist.info | 2 +-
4 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/alt_getopt b/alt_getopt
index 4a48bf4..9fafee6 100755
--- a/alt_getopt
+++ b/alt_getopt
@@ -1,6 +1,6 @@
#!/usr/bin/env lua
-require "alt_getopt"
+local alt_getopt = require "alt_getopt"
local long_opts = {
verbose = "v",
diff --git a/alt_getopt.lua b/alt_getopt.lua
index 7a6591a..efba5ac 100644
--- a/alt_getopt.lua
+++ b/alt_getopt.lua
@@ -21,8 +21,6 @@
local type, pairs, ipairs, io, os = type, pairs, ipairs, io, os
-module ("alt_getopt")
-
local function convert_short2long (opts)
local i = 1
local len = #opts
@@ -61,7 +59,7 @@ local function canonize (options, opt)
return opt
end
-function get_ordered_opts (arg, sh_opts, long_opts)
+local function get_ordered_opts (arg, sh_opts, long_opts)
local i = 1
local count = 1
local opts = {}
@@ -150,7 +148,7 @@ function get_ordered_opts (arg, sh_opts, long_opts)
return opts,i,optarg
end
-function get_opts (arg, sh_opts, long_opts)
+local function get_opts (arg, sh_opts, long_opts)
local ret = {}
local opts,optind,optarg = get_ordered_opts (arg, sh_opts, long_opts)
@@ -164,3 +162,8 @@ function get_opts (arg, sh_opts, long_opts)
return ret,optind
end
+
+return {
+ get_ordered_opts = get_ordered_opts,
+ get_opts = get_opts,
+}
diff --git a/dist.info b/dist.info
index 37f626a..02abf2a 100644
--- a/dist.info
+++ b/dist.info
@@ -1,7 +1,7 @@
--- This file is part of LuaDist project
name = "alt-getopt"
-version = "0.7"
+version = "0.7-1"
maintainer = "Peter Drahoš"
desc = "Process application arguments the same way as getopt_long"
|