[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Question about metamethods
- From: L-28C <kixdemp@...>
- Date: Sat, 14 Apr 2007 18:39:31 -0400
Hello everyone!
So I have this 'class':
-- Part of Graphics.lua --
Image = {}
Image.mt = {}
Image.mt.index = Image
function Image:Empty(w, h)
local i = {}
i.baseImg = SDL.SDL_CreateRGBSurface(SDL.SDL_SWSURFACE, w, h, 32, 0, 0,
0, 0)
return setmetatable(i, Image.mt)
end
function Image:Clear(color)
SDL.SDL_FillRect(self.baseImg, nil, color)
end
-- End --
-- Part of another file --
shieldsLyr = Image:Empty(scrWidth, scrHeight)
shieldsLyr:Clear(transp)
-- End --
That last line tells me the method 'Clear' is nil.
Why? Am I doing something wrong? Thanks!