wok-next view lua-alt-getopt/stuff/patches/lua5.2-compat.patch @ rev 21151

Add/update some Lua packages
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Jan 31 00:34:43 2019 +0200 (2019-01-31)
parents
children
line source
1 From 86eb438ffb3580e6f7e82c17929d59c914dd46cb Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Peter=20Drahos=CC=8C?= <drahosp@gmail.com>
3 Date: Wed, 16 May 2012 10:40:55 +0200
4 Subject: [PATCH] Updated lua 5.2 compatibility
6 ---
7 CMakeLists.txt | 2 +-
8 alt_getopt | 2 +-
9 alt_getopt.lua | 11 +++++++----
10 dist.info | 2 +-
11 4 files changed, 10 insertions(+), 7 deletions(-)
13 diff --git a/alt_getopt b/alt_getopt
14 index 4a48bf4..9fafee6 100755
15 --- a/alt_getopt
16 +++ b/alt_getopt
17 @@ -1,6 +1,6 @@
18 #!/usr/bin/env lua
20 -require "alt_getopt"
21 +local alt_getopt = require "alt_getopt"
23 local long_opts = {
24 verbose = "v",
25 diff --git a/alt_getopt.lua b/alt_getopt.lua
26 index 7a6591a..efba5ac 100644
27 --- a/alt_getopt.lua
28 +++ b/alt_getopt.lua
29 @@ -21,8 +21,6 @@
31 local type, pairs, ipairs, io, os = type, pairs, ipairs, io, os
33 -module ("alt_getopt")
34 -
35 local function convert_short2long (opts)
36 local i = 1
37 local len = #opts
38 @@ -61,7 +59,7 @@ local function canonize (options, opt)
39 return opt
40 end
42 -function get_ordered_opts (arg, sh_opts, long_opts)
43 +local function get_ordered_opts (arg, sh_opts, long_opts)
44 local i = 1
45 local count = 1
46 local opts = {}
47 @@ -150,7 +148,7 @@ function get_ordered_opts (arg, sh_opts, long_opts)
48 return opts,i,optarg
49 end
51 -function get_opts (arg, sh_opts, long_opts)
52 +local function get_opts (arg, sh_opts, long_opts)
53 local ret = {}
55 local opts,optind,optarg = get_ordered_opts (arg, sh_opts, long_opts)
56 @@ -164,3 +162,8 @@ function get_opts (arg, sh_opts, long_opts)
58 return ret,optind
59 end
60 +
61 +return {
62 + get_ordered_opts = get_ordered_opts,
63 + get_opts = get_opts,
64 +}