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

  • SEARCH
  • Home
  • 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 905799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:16:48+00:00 2026-05-15T16:16:48+00:00

I have found myself having to turn a chunk of Lua code into a

  • 0

I have found myself having to turn a chunk of Lua code into a string so it can be run as a proper Lua chunk.
Writing code like that is not too difficult, but it’s time consuming and prone to minor errors that result in lost development time and patience.

Is there any tool/filter capable of taking a piece of runnable code and turning it into a proper string?

If I am not explaining myself right (not native English speaker, my apologies!), I want to find a tool that turns code like

MyFunction("String!")

into

"MyFunction(\"String!\")"

It’s trivial in the example, but when talking several lines of code, it’s pretty tedious.

I am using Linux as my main OS, perhaps there is some filtering tool available? A Lua-based solution would be interesting just for amusement, too.

  • 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-15T16:16:49+00:00Added an answer on May 15, 2026 at 4:16 pm

    You can just wrap the code with a long string. This should be simple regardless of the method you use to achieve it:

    myString = [==[
        for i = 1, 10 do
            print("Hello #"..i)
        end
    ]==]
    

    You can have as many = signs as you want (including none) between the opening and closing brackets as long as they match. This way you’re sure to have an “end comment” symbol that doesn’t appear in the enclosed source code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have found myself doing this in my code to 'cache' the work done
FOUND THE ANSWER MYSELF, see below... I'd like to have a very simple user
I found myself having to remove the first line of a string quite often
Recently, I found myself having to write up some concerns I have about race
I have found myself designing a language for fun that is a cross between
I am doing some C programming for school and I have found myself reusing
I am new to fairly new to AS3 and I have found myself needing
I am developing a fairly large C++ support library, and have found myself moving
I have recently found myself becoming more negative about EF and cannot help wondering
I have been playing with NodeJS lately and i found myself stuck with a

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.