All Questions
688
questions
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 ...
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 :...
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 ...
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 ...
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 ...
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....
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 ...
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 ==&...
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 ...
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 ...
2
votes
3
answers
72
views
Lua | String Pattern Replacement
local str = {
["red"] = "ff0000",
["blue"] = "4C9FFF",
["purple"] = "C33AFF",
["green"] = "53FF4A",
[...
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, ...
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 ...
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 = "...
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 ...