How do you convert integer to string in lua?

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I essentially want to put a % symbol before a numbervalue.
  2. What is the issue? Include screenshots / videos if possible!
    I don’t know how to because I have 1 month of experience and somehow havent found an answer.
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    Yes, I’ve tried
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
-- This is an example Lua code block

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

If you want to convert a interger to a string, you could use tostring()


Can you give me an example on this?

You can combine a % symbol with the NumberValue number like so:

Percent = "%" .. tostring(NumberValue.Value) --use the .. operator to combine the two values

Here’s an example:

local number = 9
local string = tostring(number)


Ahhh ok I got it and also same for Eduardo’s example


What the function looks like

// LuaGlobal
string tostring(Variant e);
Receives an argument of any type and converts it to a string in a reasonable format. 
For complete control of how numbers are converted, use string.format. 
If the metatable of e has a __tostring metamethod, then it will be called with e as the only argument and will return the result.

An example

local x = 1
print(typeof(x)) -- int
x = tostring(x)
print(typeof(x)) -- string

Ok thanks (30 Characters needed)