Skip to content

SDLK_ESCAPE wrong? #1

Description

@nonchip

I'm using sdl2-ffi in my YEng project, and try to handle the escape keypress, which doesn't work as expected. my code:

if event.type == Y.sdl.KEYUP then
  print(event.key.keysym.sym,Y.sdl.K.ESCAPE,type(event.key.keysym.sym),type(Y.sdl.K.ESCAPE))
end

output when pressing the escape key:

27 23 number number

Y.sdl defined as:

local core_sdl=require'sdl2'
local additional_sdl = {}
local meta_sdl = {
  __index = function(self, key)
    return additional_sdl[key]
  end
}
local meta_K={
  __index = function(self, key)
    return tonumber(core_sdl.C['SDLK_'..key])
  end
}
additional_sdl.K=setmetatable({},meta_K)
Y.sdl = setmetatable(core_sdl, meta_sdl)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions