Home > Software engineering >  String value within a string value
String value within a string value

Time:03-23

As stated above is the thing I am attempting to accomplish. I am using Pilot.Lua

local a = "I am a text"
local textbox = ({value="local a = "I am a text""})

Problem here is that if I was to transfer this sample code into "textbox" I would receive an error due to the "I am a text" being read as code rather than a string value. Is there any way around this?

CodePudding user response:

You need to escape the quotation marks with backslashes

local a = "I am a text"
local textbox = ({value="local a = \"I am a text\""})

CodePudding user response:

Use single quotes

local textbox = ({value='local a = "I am a text"'})

or long strings:

local textbox = ({value=[[local a = "I am a text"]]})
  • Related