Issue #14 resolved

gamepad allJustReleased function

Anonymous created an issue

Think I found a typo. in core/gamepad.lua @ line 240, allJustPressed() is defined twice instead of defining allJustReleased()

Snippet below:

-- Method: allJustPressed
    -- Returns all buttons just pressed this frame.
    --
    -- Arguments:
    --      none
    --
    -- Returns:
    --      string button descriptions; if nothing is just pressed, nil

    allJustPressed = function (self)
        local result = {}

        for key, value in pairs(self._thisFrame) do
            if value and not self._lastFrame[key] then table.insert(result, key) end
        end

        return unpack(result)
    end,

    -- Method: allJustReleased
    -- Returns all buttons just released this frame.
    --
    -- Arguments:
    --      none
    --
    -- Returns:
    --      string button descriptions; if nothing is just pressed, nil

    allJustPressed = function (self)
        local result = {}

        for key, value in pairs(self._thisFrame) do
            if not value and self._lastFrame[key] then table.insert(result, key) end
        end

        return unpack(result)
    end,

I changed the second allJustPressed to allJustReleased and seemed to work correctly.

Comments (1)

  1. Log in to comment