From 93f74c1adbda89848a7cec46e20b591cbf14de3a Mon Sep 17 00:00:00 2001 From: Rochet2 Date: Sat, 19 Nov 2016 19:57:48 +0200 Subject: [PATCH] Make error more verbose --- ElunaQueryMethods.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ElunaQueryMethods.h b/ElunaQueryMethods.h index 9f76edb..07e8b33 100644 --- a/ElunaQueryMethods.h +++ b/ElunaQueryMethods.h @@ -24,8 +24,14 @@ namespace LuaQuery { static void CheckFields(lua_State* L, ElunaQuery* result) { - if (Eluna::CHECKVAL(L, 2) >= RESULT->GetFieldCount()) - luaL_argerror(L, 2, "invalid field index"); + uint32 field = Eluna::CHECKVAL(L, 2); + uint32 count = RESULT->GetFieldCount(); + if (field >= count) + { + char arr[256]; + sprintf(arr, "trying to access invalid field index %u. There are %u fields available and the indexes start from 0", field, count); + luaL_argerror(L, 2, arr); + } } /**