local gs = {}
gs.__index = gs
local i = ""
function gs:Init(x)
i = x
print(x.." Initialized!")
end
setmetatable(gs, {
_call = function(cls,...)
return cls.new(...)
end,
})
function gs.NewGif(init)
local self = setmetatable({},gs)
local frames = love.filesystem.getDirectoryItems(init)
print("Loading Frames From..."..init)
for i = 1, #frames do
-- Help Here!
end
return self
end
return gs
Okay so I'm not very familiar with tables/meta-tables in lua, but I do know a thing or two. What I'm trying to accomplish is to create a new image and store it in a table. And to be able to access it to draw it later on. Help is much appreciated and needed.
local frames = love.filesystem.getDirectoryItems(init)
print("Loading Frames From..."..init)
for i = 1, #frames do
print("Frame: "..i.." "..frames[i])
-- Store Image in table :/
end
local images = {}
local frames = love.filesystem.getDirectoryItems(init)
print("Loading Frames From..."..init)
for i = 1, #frames do
print("Frame: "..i.." "..frames[i])
-- Store Image in table
images[i] = love.graphics.newImage(frames[i])
end
Probably not entirely complete though, you'll need to remove directories from the frames table first. And then assuming all the other files are indeed image files.