Posted 12 November 2016 - 06:12 AM
– obj.lua
My problem is that when I print from the array in obj1, it is actually referencing obj2's array. Ideally this would print 1 instead of 4.
Is it not possible to return a unique table instance from an api function call, or am I just missing some syntax somewhere?
Any help is much appreciated!
function new(array)
return {array = array}
end
– test.luaos.loadAPI('obj.lua')
arr1 = {1,2,3}
arr2 = {4,5,6}
obj1 = obj.new(arr1)
obj2 = obj.new(arr2)
print(obj1.array[1]) -- prints: 4
My problem is that when I print from the array in obj1, it is actually referencing obj2's array. Ideally this would print 1 instead of 4.
Is it not possible to return a unique table instance from an api function call, or am I just missing some syntax somewhere?
Any help is much appreciated!