Mercurial Hosting > luan
changeset 1262:81d3a01fbd09
minor
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Mon, 24 Sep 2018 14:48:59 -0600 |
parents | 198d6af7330a |
children | 382c444a6c77 |
files | src/luan/modules/Table.luan |
diffstat | 1 files changed, 9 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/luan/modules/Table.luan Mon Sep 24 13:09:16 2018 -0600 +++ b/src/luan/modules/Table.luan Mon Sep 24 14:48:59 2018 -0600 @@ -24,7 +24,15 @@ local toTable = LuanJava.toTable or error() function Table.java_to_table_shallow(obj) - return toTable(obj) or error("can't convert type "..obj.getClass().getName().." to table") + local rtn = toTable(obj) + if rtn ~= nil then + return rtn + end + local tp = type(obj) + if tp == "java" then + tp = obj.getClass().getName() + end + error("can't convert type "..tp.." to table") end local to_luan, deepen