Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
0 votes
1 answer
20 views

How can I use a parameter to alter which data my profile.Data is accessing?

local expType = tostring(type1) local expTypeStat = expType:gsub("Exp", "") local profileDataExpType = "profile.Data."..expType Here I want to change ...
Lukas Raby's user avatar
2 votes
1 answer
29 views

What's the advantage and disadvantage that using string.format("str", ...) instead of "str":format(...) in Lua?

I found a interesting problem in Lua. Lua provides string.format function to format the string, and the first parameter of this function is the string you want to format. Coincidentally, Lua allows :...
SHW's user avatar
  • 23
0 votes
1 answer
38 views

Detect text block between two tags

I have a file structured like this $$ some text $$ and I would like to make my script reveal when there is a block of text present within the "$$" tags. This script works well when the text ...
user3204810's user avatar
2 votes
3 answers
57 views

Weird behaviour in Lua string.gmatch

I would need to extract everything that comes before and everything that comes after the "\\scalebox" string. I tried with local example = "sometext\\scalebox{0.74}" for i in ...
user3204810's user avatar
1 vote
1 answer
58 views

attempt to concatenate string with nil | Roblox Code, How to fix?

I've been working on a GUI system where I have a health, stamina and EXP bar. Once I finally got towards the end, I was given an error message on this part of code, saying: attempt to concatenate ...
Bloop Icon's user avatar
6 votes
1 answer
59 views

Why does this sting.find fail?

string.find("MOZ-MAIL-1-1","MOZ-MAIL-") string.find("MOZ-MAIL-1-1","OZ-MAIL-") Given the above, why do those return false, but the following succeed? string....
Paul Eden's user avatar
  • 440
2 votes
1 answer
75 views

How can I convert a String that is formatted like a table, into a table?

I did find a version of this for a string into a table that splits up the letters of the string, but I have a table, that I turn into a string to remove the first part of it, and now I want it back as ...
Asher Roland's user avatar
1 vote
4 answers
53 views

What is the "undetected" symbol in lua

a = string.sub("слово", 1,1) слово is a word in russian which needs 2 bytes for every letter and the output for print(a) is going to something like � depending on where you run it if a ==&...
Consler's user avatar
  • 75
0 votes
1 answer
59 views

How to overload functions string.byte and string.char to support Unicode UTF-8?

I have custom functions utf8Char (decimal) and utf8Byte(char). How can I overload the functions string.char(...) and string.byte(s, i, j) in Lua? Here is an example function what I mean: local ...
darkfrei's user avatar
  • 448
2 votes
0 answers
35 views

Lua string.gmatch find empty fields between separators

I'm currently trying to convert a string into a table via separators. The separating itself works perfectly fine. In my example, I have two different separators. A ';' which leaves a string separated ...
milk's user avatar
  • 23
2 votes
3 answers
72 views

Lua | String Pattern Replacement

local str = { ["red"] = "ff0000", ["blue"] = "4C9FFF", ["purple"] = "C33AFF", ["green"] = "53FF4A", [...
Mersad's user avatar
  • 27
0 votes
1 answer
46 views

How to capture the integer or point number from string?

I have this string S = "564186207, 399.4989929 , ABC, degds, 2425, 335.232" and I want to capture the only integer and point number. Like this: string.gfind(S, ???) --> 564186207, ...
우상화's user avatar
0 votes
0 answers
25 views

lua : string to table by some criteria [duplicate]

I have csv file and I want to change each line to table csv format like this case1) 564186207,399.4989929,3317.988037,7287824519535926300,32,30,17,17,0,50000,50000 case2) 8916.1350 8986.6161 15.8202 ...
우상화's user avatar
0 votes
0 answers
95 views

Random string in lua

I'm trying to create in a lua script a function for generating random strings. This is my code: math.randomseed(os.time()) local charset = "...
Jepessen's user avatar
  • 12.2k
2 votes
1 answer
223 views

Remove both path and extension from string in Lua

I'm trying to get the name of the file without the path and the extension in one go. I am using string.match and ([^\\/]+)$ to get rid of the path and then another string.match with (.+)%.[^.]+$ to ...
JimPancakes's user avatar

15 30 50 per page
1
2 3 4 5
46