comparison src/luan/modules/Table.luan @ 1262:81d3a01fbd09

minor
author Franklin Schmidt <fschmidt@gmail.com>
date Mon, 24 Sep 2018 14:48:59 -0600
parents 198d6af7330a
children 9fa8b8389578
comparison
equal deleted inserted replaced
1261:198d6af7330a 1262:81d3a01fbd09
22 local pairs = Luan.pairs or error() 22 local pairs = Luan.pairs or error()
23 local LuanJava = require "java:luan.Luan" 23 local LuanJava = require "java:luan.Luan"
24 local toTable = LuanJava.toTable or error() 24 local toTable = LuanJava.toTable or error()
25 25
26 function Table.java_to_table_shallow(obj) 26 function Table.java_to_table_shallow(obj)
27 return toTable(obj) or error("can't convert type "..obj.getClass().getName().." to table") 27 local rtn = toTable(obj)
28 if rtn ~= nil then
29 return rtn
30 end
31 local tp = type(obj)
32 if tp == "java" then
33 tp = obj.getClass().getName()
34 end
35 error("can't convert type "..tp.." to table")
28 end 36 end
29 37
30 local to_luan, deepen 38 local to_luan, deepen
31 39
32 function to_luan(obj,java_to_table_shallow) 40 function to_luan(obj,java_to_table_shallow)