[View]  [Edit]  [Lock]  [References]  [Attachments]  [History]  [Home]  [Changes]  [Search]  [Help] 

sample[LuaStudio] Lazy initialize m8n base

--loadBase.lua
loadBase = function()
-- check if m8n base is present

-- m8n is not present, get m8n from URL

-- load m8n base

	local bytes = Lib.Sys.IO.File.getBytes("/m8n/aleReimondo/516/assets/sample.zip")
	print("Zip file size: ".. bytes.length)

	local bytesInput = Lib.Sys.IO.BytesInput.new(bytes, 0, bytes.length)
	local entries = Lib.Sys.Zip.Reader.readZip(bytesInput)

	bytesInput.close()

	for i=1,#entries,1 do
		   local fileName = entries[i].fileName
		   print("fileName: ".. fileName)
		   local dataBytes = Lib.Sys.Zip.Reader.unzip(entries[i])
		   local byteArray = Lib.Media.Utils.ByteArray.fromBytes(dataBytes)
--		   print("length: ".. byteArray.length)
--		   print("content: ".. byteArray.asString())
	end
end

loadBase()