From 2c55477161d3026af68486a7e0a887e18fb18853 Mon Sep 17 00:00:00 2001 From: toaster Date: Fri, 18 Mar 2022 18:59:25 +0000 Subject: [PATCH] Revert "Make the colormap returned by v.getColormap() writable." This reverts commit 53ec97288724b38632c47f52d22d3eecdcd464c0. --- src/lua_hudlib.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 5c49b1d4a..75a84ed18 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -251,7 +251,7 @@ static int hudinfo_num(lua_State *L) static int colormap_get(lua_State *L) { - UINT8 *colormap = *((UINT8 **)luaL_checkudata(L, 1, META_COLORMAP)); + const UINT8 *colormap = *((UINT8 **)luaL_checkudata(L, 1, META_COLORMAP)); UINT32 i = luaL_checkinteger(L, 2); if (i >= 256) return luaL_error(L, "colormap index %d out of range (0 - %d)", i, 255); @@ -259,16 +259,6 @@ static int colormap_get(lua_State *L) return 1; } -static int colormap_set(lua_State *L) -{ - UINT8 *colormap = *((UINT8 **)luaL_checkudata(L, 1, META_COLORMAP)); - UINT32 i = luaL_checkinteger(L, 2); - if (i >= 256) - return luaL_error(L, "colormap index %d out of range (0 - %d)", i, 255); - colormap[i] = (UINT8)luaL_checkinteger(L, 3); - return 0; -} - static int patch_get(lua_State *L) { patch_t *patch = *((patch_t **)luaL_checkudata(L, 1, META_PATCH)); @@ -1341,9 +1331,6 @@ int LUA_HudLib(lua_State *L) luaL_newmetatable(L, META_COLORMAP); lua_pushcfunction(L, colormap_get); lua_setfield(L, -2, "__index"); - - lua_pushcfunction(L, colormap_set); - lua_setfield(L, -2, "__newindex"); lua_pop(L,1); luaL_newmetatable(L, META_PATCH);