shithub: lua9

Download patch

ref: 554c1ebdd87fb0f506160561d7a88bdf359ebb98
parent: 4b85198fa16b3c925e00b506cc48f9a7214868b2
author: telephil9 <telephil9@gmail.com>
date: Mon Oct 26 04:02:17 EDT 2020

event.menuhit() return index start at 1

	lua table indices are starting at 1 not 0 like in C. This makes the API more  lua looking .

--- a/event.c
+++ b/event.c
@@ -139,7 +139,10 @@
 	m = checkmouse(L, 2);
 	menu.item = checkstrings(L, 3);
 	r = emenuhit(b, &m, &menu);
-	lua_pushinteger(L, r);
+	if(r >= 0)
+		lua_pushinteger(L, r + 1);
+	else
+		lua_pushnil(L);
 	return 1;
 }