diff src/luan/modules/Table.luan @ 1464:465b4a0dae4a

empty list vs map
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 03 Apr 2020 10:04:52 -0600
parents 8d95711f6615
children fa066aaa068c
line wrap: on
line diff
--- a/src/luan/modules/Table.luan	Mon Mar 30 18:31:18 2020 -0600
+++ b/src/luan/modules/Table.luan	Fri Apr 03 10:04:52 2020 -0600
@@ -21,6 +21,7 @@
 local type = Luan.type or error()
 local pairs = Luan.pairs or error()
 local toTable = TableLuan.toTable or error()
+local copy = Table.copy or error()
 
 function Table.java_to_table_shallow(obj)
 	local rtn = toTable(obj)
@@ -41,13 +42,12 @@
 end
 
 function deepen(tbl,java_to_table_shallow)
-	local rtn = {}
-	for key, value in pairs(tbl) do
+	for key, value in pairs(copy(tbl)) do
 		key = to_luan(key,java_to_table_shallow)
 		value = to_luan(value,java_to_table_shallow)
-		rtn[key] = value
+		tbl[key] = value
 	end
-	return rtn
+	return tbl
 end
 
 function Table.java_to_table_deep(obj,java_to_table_shallow)