summary refs log tree commit diff stats
path: root/plugins/lua
diff options
context:
space:
mode:
authorSoniEx2 <endermoneymod@gmail.com>2021-05-27 20:39:07 -0300
committerSoniEx2 <endermoneymod@gmail.com>2021-05-27 20:39:07 -0300
commit5571d277b93b62c73568b78c652c85b2e8e95183 (patch)
tree0d97d65058e31ccdeab4006384442a8e378d5f06 /plugins/lua
parentf58165fd33919951e2ca594c6f19a785420fc4f9 (diff)
parent7f8b0a19cff46f7d27451fb9942eea5018f0c5b5 (diff)
Merge upstream changes
Diffstat (limited to 'plugins/lua')
-rw-r--r--plugins/lua/lua.c16
-rw-r--r--plugins/lua/lua.vcxproj2
2 files changed, 10 insertions, 8 deletions
diff --git a/plugins/lua/lua.c b/plugins/lua/lua.c
index 941342bb..d1370eaf 100644
--- a/plugins/lua/lua.c
+++ b/plugins/lua/lua.c
@@ -35,6 +35,8 @@
 
 #include <hexchat-plugin.h>
 
+#define WORD_ARRAY_LEN 32
+
 static char plugin_name[] = "Lua";
 static char plugin_description[] = "Lua scripting interface";
 static char plugin_version[16] = "1.3";
@@ -275,13 +277,13 @@ static int api_command_closure(char *word[], char *word_eol[], void *udata)
 	base = lua_gettop(L);
 	lua_rawgeti(L, LUA_REGISTRYINDEX, info->ref);
 	lua_newtable(L);
-	for(i = 1; i < 32 && *word_eol[i]; i++)
+	for(i = 1; i < WORD_ARRAY_LEN && *word_eol[i]; i++)
 	{
 		lua_pushstring(L, word[i]);
 		lua_rawseti(L, -2, i);
 	}
 	lua_newtable(L);
-	for(i = 1; i < 32 && *word_eol[i]; i++)
+	for(i = 1; i < WORD_ARRAY_LEN && *word_eol[i]; i++)
 	{
 		lua_pushstring(L, word_eol[i]);
 		lua_rawseti(L, -2, i);
@@ -462,13 +464,13 @@ static int api_server_closure(char *word[], char *word_eol[], void *udata)
 	base = lua_gettop(L);
 	lua_rawgeti(L, LUA_REGISTRYINDEX, info->ref);
 	lua_newtable(L);
-	for(i = 1; i < 32 && *word_eol[i]; i++)
+	for(i = 1; i < WORD_ARRAY_LEN && *word_eol[i]; i++)
 	{
 		lua_pushstring(L, word[i]);
 		lua_rawseti(L, -2, i);
 	}
 	lua_newtable(L);
-	for(i = 1; i < 32 && *word_eol[i]; i++)
+	for(i = 1; i < WORD_ARRAY_LEN && *word_eol[i]; i++)
 	{
 		lua_pushstring(L, word_eol[i]);
 		lua_rawseti(L, -2, i);
@@ -521,13 +523,13 @@ static int api_server_attrs_closure(char *word[], char *word_eol[], hexchat_even
 	base = lua_gettop(L);
 	lua_rawgeti(L, LUA_REGISTRYINDEX, info->ref);
 	lua_newtable(L);
-	for(i = 1; i < 32 && *word_eol[i]; i++)
+	for(i = 1; i < WORD_ARRAY_LEN && *word_eol[i]; i++)
 	{
 		lua_pushstring(L, word[i]);
 		lua_rawseti(L, -2, i);
 	}
 	lua_newtable(L);
-	for(i = 1; i < 32 && *word_eol[i]; i++)
+	for(i = 1; i < WORD_ARRAY_LEN && *word_eol[i]; i++)
 	{
 		lua_pushstring(L, word_eol[i]);
 		lua_rawseti(L, -2, i);
@@ -1187,11 +1189,11 @@ static void patch_clibs(lua_State *L)
 		if(lua_type(L, -2) == LUA_TLIGHTUSERDATA && lua_type(L, -1) == LUA_TTABLE)
 		{
 			lua_setfield(L, LUA_REGISTRYINDEX, "_CLIBS");
+			lua_pop(L, 1);
 			break;
 		}
 		lua_pop(L, 1);
 	}
-	lua_pop(L, 1);
 }
 
 static GPtrArray *scripts;
diff --git a/plugins/lua/lua.vcxproj b/plugins/lua/lua.vcxproj
index 22afe729..5c0be68e 100644
--- a/plugins/lua/lua.vcxproj
+++ b/plugins/lua/lua.vcxproj
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <PropertyGroup Label="Configuration">
-    <PlatformToolset>v140</PlatformToolset>
+    <PlatformToolset>v142</PlatformToolset>
     <ConfigurationType>DynamicLibrary</ConfigurationType>
   </PropertyGroup>
   <ItemGroup Label="ProjectConfigurations">