#convert string to variable

1 messages · Page 1 of 1 (latest)

orchid fractal
#

so im making a quest system with dialogue, and im trying to make it so i dont have to split the string in half to put a variable inbetween

is there a solution to my problem?
like maybe a way to do string.split and like find a keyword?? idk

orchid fractal
#

was thinking something like this

zealous raptor
#
local playerName = "Alex"
local questText = string.format("Hello %s, your quest is ready.", playerName)
orchid fractal
#

ohh

zealous raptor
#

place %s instead of <#apples>

#

and format ts

orchid fractal
#

okk ill try that

#

tysm

zealous raptor
#

ywyw

orchid fractal
#

what does %s even do

#

or mainly

#

string.format

#

i could just look up the documentation

#

mb

zealous raptor
#

if u place %s instead of <#apples>

#

u can place a string

#

instead of %s

#

easily

#

i mean theres probably other ways

#

but

orchid fractal
#

yea

zealous raptor
#

i believe this is the easiest

orchid fractal
#

okk ill try it

zealous raptor
#

for string

#

do %s

#

for integer

#

do %d

orchid fractal
zealous raptor
#

like what

#

multiple but different strings?

orchid fractal
#

uhh idk how to explain

#

like for example i would need to the max value of things you need to collect in the quest

#

but also if the max value was 1

#

it needs to not be plural

#

so that would be a different variable

zealous raptor
#

wym

orchid fractal
#

nvm i figured it out

#

ty