Mercurial Hosting > luan
changeset 1706:93b9fd13a06c
Luan.arg fix
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 04 Jul 2022 12:30:16 -0600 |
parents | a6e27c8e7ef4 |
children | ad5647031343 |
files | src/luan/LuanTable.java src/luan/modules/Luan.luan |
diffstat | 2 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
diff -r a6e27c8e7ef4 -r 93b9fd13a06c src/luan/LuanTable.java --- a/src/luan/LuanTable.java Sun Jul 03 21:59:38 2022 -0600 +++ b/src/luan/LuanTable.java Mon Jul 04 12:30:16 2022 -0600 @@ -259,7 +259,11 @@ public Object removeFromList(int pos) throws LuanException { checkMutable(); - return list().remove(pos-1); + try { + return list().remove(pos-1); + } catch(IndexOutOfBoundsException e) { + throw new LuanException("index out of bounds - "+e.getMessage()); + } } public void rawSort(Comparator<Object> cmp) throws LuanException {
diff -r a6e27c8e7ef4 -r 93b9fd13a06c src/luan/modules/Luan.luan --- a/src/luan/modules/Luan.luan Sun Jul 03 21:59:38 2022 -0600 +++ b/src/luan/modules/Luan.luan Mon Jul 04 12:30:16 2022 -0600 @@ -51,7 +51,9 @@ if JavaLuan.args ~= nil then local args = TableLuan.toTable(JavaLuan.args) - args[0] = TableLuan.remove(args,1) + if #args > 0 then + args[0] = TableLuan.remove(args,1) + end Luan.arg = args end