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
This commit is contained in:
Andrew Minnich
2018-07-04 23:38:58 -04:00
parent 85e8201164
commit cd45b9f1af

View File

@@ -76,8 +76,12 @@ local Player = {}
Player.__index = Player Player.__index = Player
function Player:_loadConfig(config) function Player:_loadConfig(config)
assert(config, 'No config table provided') if not config then
assert(config.controls, 'No controls specified') error('No config table provided', 4)
end
if not config.controls then
error('No controls specified', 4)
end
config.pairs = config.pairs or {} config.pairs = config.pairs or {}
config.deadzone = config.deadzone or .5 config.deadzone = config.deadzone or .5
config.squareDeadzone = config.squareDeadzone or false config.squareDeadzone = config.squareDeadzone or false