mouse: add __index
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
0c4b56a065
commit
0cbf293e13
21
mouse.c
21
mouse.c
|
@ -1136,6 +1136,7 @@ luaA_mouse_screen_get(lua_State *L)
|
||||||
|
|
||||||
/** Create a new mouse button bindings.
|
/** Create a new mouse button bindings.
|
||||||
* \param L The Lua VM state.
|
* \param L The Lua VM state.
|
||||||
|
* \return The number of elements pushed on stack.
|
||||||
* \luastack
|
* \luastack
|
||||||
* \lparam A table with modifiers keys.
|
* \lparam A table with modifiers keys.
|
||||||
* \lparam A mouse button number.
|
* \lparam A mouse button number.
|
||||||
|
@ -1168,9 +1169,29 @@ luaA_mouse_new(lua_State *L)
|
||||||
return luaA_mouse_userdata_new(L, button);
|
return luaA_mouse_userdata_new(L, button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Index for mouse.
|
||||||
|
* \param L The Lua VM state.
|
||||||
|
* \return The number of elements pushed on stack.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
luaA_mouse_index(lua_State *L)
|
||||||
|
{
|
||||||
|
size_t len;
|
||||||
|
const char *attr = luaL_checklstring(L, 1, &len);
|
||||||
|
|
||||||
|
switch(a_tokenize(attr, len))
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
const struct luaL_reg awesome_mouse_methods[] =
|
const struct luaL_reg awesome_mouse_methods[] =
|
||||||
{
|
{
|
||||||
{ "__call", luaA_mouse_new },
|
{ "__call", luaA_mouse_new },
|
||||||
|
{ "__index", luaA_mouse_index },
|
||||||
{ "screen_get", luaA_mouse_screen_get },
|
{ "screen_get", luaA_mouse_screen_get },
|
||||||
{ "coords_set", luaA_mouse_coords_set },
|
{ "coords_set", luaA_mouse_coords_set },
|
||||||
{ "coords_get", luaA_mouse_coords_get },
|
{ "coords_get", luaA_mouse_coords_get },
|
||||||
|
|
Loading…
Reference in New Issue