aports/main/lua-alt-getopt/lua5.2-compat.patch
2015-07-23 13:33:29 +00:00

78 lines
1.9 KiB
Diff

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"