mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
Make error more verbose
This commit is contained in:
@@ -24,8 +24,14 @@ namespace LuaQuery
|
|||||||
{
|
{
|
||||||
static void CheckFields(lua_State* L, ElunaQuery* result)
|
static void CheckFields(lua_State* L, ElunaQuery* result)
|
||||||
{
|
{
|
||||||
if (Eluna::CHECKVAL<uint32>(L, 2) >= RESULT->GetFieldCount())
|
uint32 field = Eluna::CHECKVAL<uint32>(L, 2);
|
||||||
luaL_argerror(L, 2, "invalid field index");
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user