Results 1 to 5 of 5

Thread: [OGL] isIndexing

  1. #1
    Join Date
    Jun 2014
    Posts
    463
    Mentioned
    27 Post(s)
    Quoted
    229 Post(s)

    Default [OGL] isIndexing

    Well, figured this looks nicer and is pretty neat.

    Simba Code:
    function isIndexing(id: uInt32;option: string): boolean;
    begin
      if execRegExpr('^(m(odels)?)$',option) then
      begin
        if (ogl.getModels(id).indexes()) then exit(true);
      end else if execRegExpr('^(t(extures)?)$',option) then
      begin
        if (ogl.getTextures(id).indexes()) then exit(true);
      end;
    end;

    example usage: (123 is the model/texture ID depending on the string)
    Simba Code:
    if isIndexing(123, 'm') then
    Simba Code:
    if isIndexing(123, 'models') then
    Simba Code:
    if isIndexing(123, 't') then
    Simba Code:
    if isIndexing(123, 'textures') then
    Tsunami

  2. #2
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Regex is usually considered to be slow, so this should probably use a different method to check. I would honestly say it could and should use a constant.

  3. #3
    Join Date
    Jun 2014
    Posts
    463
    Mentioned
    27 Post(s)
    Quoted
    229 Post(s)

    Default

    Quote Originally Posted by tls View Post
    Regex is usually considered to be slow, so this should probably use a different method to check. I would honestly say it could and should use a constant.
    Thanks for the advice
    Tsunami

  4. #4
    Join Date
    Mar 2007
    Posts
    5,125
    Mentioned
    275 Post(s)
    Quoted
    901 Post(s)

    Default

    Moved to correct section.

    Forum account issues? Please send me a PM

  5. #5
    Join Date
    Jan 2012
    Posts
    2,568
    Mentioned
    35 Post(s)
    Quoted
    356 Post(s)

    Default

    Quote Originally Posted by tls View Post
    Regex is usually considered to be slow, so this should probably use a different method to check. I would honestly say it could and should use a constant.
    For simple short regex like that it should be negligible time though? (<1ms)
    Though i agree should always use const/enum for these cases.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •