bjornbytes / cargo

LÖVE asset manager
MIT License
163 stars 11 forks source link

loader problem after new love2d version #11

Closed thornpw closed 6 years ago

thornpw commented 6 years ago

since the new love2d version, I get these error:

Error: lib/Cargo/cargo.lua:62: bad argument #2 to 'loader' (string expected, got no value)

If did hat hotfix: local asset = nil if extension ~= "wav" then asset = loader(file) else asset = loader(file,"static") end

since I only have png's and wav's

best regards

þorN

pablomayobre commented 6 years ago

@bjornbytes The issue is that the SourceType argument in love.audio.newSource is now mandatory, and you can't specify that through cargo

bjornbytes commented 6 years ago

Maybe we could have a heuristic where big files are loaded as stream and small files are loaded as static? We could also just default to stream like in previous versions of LÖVE.

pablomayobre commented 6 years ago

The heuristic sounds cool... having stream as default for a hotfix would be simple to do

thornpw commented 6 years ago

Sounds good. Would be great to have a hotfix, since I plan to use cargo as an submodule in my library, and otherwise I have to do a fork with the nasty but working hardcoding.

bjornbytes commented 6 years ago

Alright, the latest commit should fix this. It loads the source as 'static' if it's less than 500kb in size, otherwise it uses 'stream'.