Jump to content

Create an error message


Sasu

Recommended Posts

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...