lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

That's the kind of errors you will never fix without either taking a rest or getting someone else to look at it, eh?

Thank you, Mr. Cross.

Duncan Cross wrote:
Metamethod names begin with two underscores - you're assigning to instead of

On 4/14/07, L-28C <> wrote:
Hello everyone!

So I have this 'class':

-- Part of Graphics.lua --
Image = {} = {} = 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,

function Image:Clear(color)
        SDL.SDL_FillRect(self.baseImg, nil, color)
-- End --

-- Part of another file --
shieldsLyr = Image:Empty(scrWidth, scrHeight)
-- End --

That last line tells me the method 'Clear' is nil.

Why? Am I doing something wrong? Thanks!