Sasu Posted September 13, 2014 Share Posted September 13, 2014 Is there a better way to output an error message on debugscript instead of make a lot of if's conditional? function dxCreateWindow ( x, y, width, height, titleBarText, relative, windowBarColor, windowColor ) if type(x) == "number" then if type(y) == "number" then if type(width) == "number" then if type(height) == "number" then if type(titleBarText) == "string" then if type(relative) == "number" then -- else return outputDebugString("[dxCreateWindow]: expected number at argument 6, got "..type(relative), 3) end else return outputDebugString("[dxCreateWindow]: expected string at argument 5, got "..type(titleBarText), 3) end else return outputDebugString("[dxCreateWindow]: expected number at argument 4, got "..type(height), 3) end else return outputDebugString("[dxCreateWindow]: expected number at argument 3, got "..type(width), 3) end else return outputDebugString("[dxCreateWindow]: expected number at argument 2, got "..type(y), 3) end else return outputDebugString("[dxCreateWindow]: expected number at argument 1, got "..type(x), 3) end end Link to comment
DNL291 Posted September 14, 2014 Share Posted September 14, 2014 You can use this function: assert Link to comment
Sasu Posted September 15, 2014 Author Share Posted September 15, 2014 You can use this function: assert Thank you Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now