From c391d76c11331dec29f3eedddb9bcc9344eb82e7 Mon Sep 17 00:00:00 2001
From: Shane Ellis <cobaltbw@gmail.com>
Date: Sat, 23 Jan 2021 10:06:47 -0500
Subject: [PATCH] buttons_last -> lastbuttons

---
 src/lua_playerlib.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/lua_playerlib.c b/src/lua_playerlib.c
index a8dc64a15e..51eb4ac0c3 100644
--- a/src/lua_playerlib.c
+++ b/src/lua_playerlib.c
@@ -372,8 +372,8 @@ static int player_get(lua_State *L)
 		lua_pushinteger(L, plr->bot);
 	else if (fastcmp(field,"botleader"))
 		LUA_PushUserdata(L, plr->botleader, META_PLAYER);
-	else if (fastcmp(field,"buttons_last"))
-		lua_pushinteger(L, plr->buttons_last);
+	else if (fastcmp(field,"lastbuttons"))
+		lua_pushinteger(L, plr->lastbuttons);
 	else if (fastcmp(field,"jointime"))
 		lua_pushinteger(L, plr->jointime);
 	else if (fastcmp(field,"quittime"))
@@ -723,6 +723,15 @@ static int player_set(lua_State *L)
 		plr->outofcoop = lua_toboolean(L, 3);
 	else if (fastcmp(field,"bot"))
 		return NOSET;
+	else if (fastcmp(field,"botleader"))
+	{
+		player_t *player = NULL;
+		if (!lua_isnil(L, 3))
+			player = *((player_t **)luaL_checkudata(L, 3, META_PLAYER));
+		plr->botleader = player;
+	}
+	else if (fastcmp(field,"lastbuttons"))
+		plr->lastbuttons = (UINT16)luaL_checkinteger(L, 3);
 	else if (fastcmp(field,"jointime"))
 		plr->jointime = (tic_t)luaL_checkinteger(L, 3);
 	else if (fastcmp(field,"quittime"))
-- 
GitLab