require('GUI.lua')
function load()
local var = love.graphics.newImage('test.gif')
LFrame = GUI:Create('Frame')
LFrame:SetPos(10,10)
LFrame:SetSize(100,100)
LFrame:SetTitle('TEST')
LFrame:SetBackgroundPic(var)
LFrame:Show(true)
end
GUI = {
Create = function(obj)
if obj == 'Frame' or obj == 'Window' then
c = {}
for k, v in pairs(Frame) do
c[k] = Frame[k]
end
end
Objects[#Objects + 1] = c
return c
end,
-- more code
}
That's easy, you use GUI:Create, this means that the function GUI.Create should have the following prototype:
function (self, obj)
Because this isn't the case, obj is set as self, instead of the argument provided, so, obj == GUI, this means that the check fails, c is never set and there is a nil value returned.