Permalink
Browse files

Make error more verbose

  • Loading branch information...
1 parent eb4eeec commit 93f74c1adbda89848a7cec46e20b591cbf14de3a @Rochet2 Rochet2 committed Nov 19, 2016
Showing with 8 additions and 2 deletions.
  1. +8 −2 ElunaQueryMethods.h
View
@@ -24,8 +24,14 @@ namespace LuaQuery
{
static void CheckFields(lua_State* L, ElunaQuery* result)
{
- if (Eluna::CHECKVAL<uint32>(L, 2) >= RESULT->GetFieldCount())
- luaL_argerror(L, 2, "invalid field index");
+ uint32 field = Eluna::CHECKVAL<uint32>(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);
+ }
}
/**

0 comments on commit 93f74c1

Please sign in to comment.