From 12c5bbfb9aa5970c806983ac671fe93f74fb2335 Mon Sep 17 00:00:00 2001 From: Alex Szpakowski Date: Wed, 10 Jul 2013 11:59:12 -0300 Subject: [PATCH] Improved error messages when a function which expects a love type gets something else --- src/common/runtime.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/runtime.h b/src/common/runtime.h index 091b66dd3..da2d9d02f 100644 --- a/src/common/runtime.h +++ b/src/common/runtime.h @@ -363,12 +363,12 @@ template T *luax_checktype(lua_State *L, int idx, const char *name, love::bits type) { if (lua_isuserdata(L, idx) == 0) - luaL_error(L, "Incorrect parameter type: expected userdata."); + luax_typerror(L, idx, name); Proxy *u = (Proxy *)lua_touserdata(L, idx); if ((u->flags & type) != type) - luaL_error(L, "Incorrect parameter type: expected %s", name); + luax_typerror(L, idx, name); return (T *)u->data; }