Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3301954
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:48:11+00:00 2026-05-17T20:48:11+00:00

Trying to write a Lua script for Scite (something like lua-users wiki: Scite Comment

  • 0

Trying to write a Lua script for Scite (something like lua-users wiki: Scite Comment Box), and when I write the following piece of code:

fchars = string.sub(line, 1, 3)

if fchars == "//" or fchars == "##" 
  print "got it"
end 

… the compilation fails with “attempt to call a string value“.

I have tried different variants, such as:

assert(ktest = (("//" == fchars) or ("##" == fchars)))

… and it seems to me that compilation fails when I try to make a ‘compound’ boolean expression using the logical operator “or“.

 

So, how would I do the above check in Lua? Maybe the C-like syntax as above is not supported at all – and I should use something like match instead?

 

Thanks in advance for any answers,
Cheers!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T20:48:11+00:00Added an answer on May 17, 2026 at 8:48 pm

    The following worked fine for me:

    line = "//thisisatest"
    
    fchars = string.sub(line, 1, 2) -- I assume you meant 1,2 since // and ##
                                    -- are only 2 characters long
    
    if fchars == "//" or fchars == "##" then -- you're missing 'then'
       print("got it!") 
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to write a piece of code to compare two strings. If either are
Im trying to write a piece of code to set the image of the
I'm trying to write a lua script to assist in modifying a game, and
Trying to write a contact form script only my following page isnt processing... <?php
I am trying write a script where when a user clicks on a link,
I m trying write code that after reset set up rrpmax as 3000. It
Trying to write a chat, like on facebook, I wondered if two clients can
Trying to write a code at the moment that basically tests to see if
Trying to write a simple C# script to copy file to directory one level
Trying to write a code that searches hash values for specific string's (input by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.