From cd45b9f1af17d42e65b73f0e408c19c20bbdfc68 Mon Sep 17 00:00:00 2001 From: Andrew Minnich Date: Wed, 4 Jul 2018 23:38:58 -0400 Subject: [PATCH] improve error messages these error messages will now tell the user where they made a mistake, rather than saying that something's wrong in baton.lua --- baton.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/baton.lua b/baton.lua index b133e14..13b930b 100644 --- a/baton.lua +++ b/baton.lua @@ -76,8 +76,12 @@ local Player = {} Player.__index = Player function Player:_loadConfig(config) - assert(config, 'No config table provided') - assert(config.controls, 'No controls specified') + if not config then + error('No config table provided', 4) + end + if not config.controls then + error('No controls specified', 4) + end config.pairs = config.pairs or {} config.deadzone = config.deadzone or .5 config.squareDeadzone = config.squareDeadzone or false