I’d like to know how I would import from a running Lua project some tags, where I keep the data for example.
Or local fonts??
I’d like to know how I would import from a running Lua project some tags, where I keep the data for example.
What does your question mean? What are “tags”? What is the Lua project? Where is it running? What kind of data are you trying to import? And what do fonts have to do with this?
A) For example I have Project 1 and Project 2. I’d like to run project 2 and if in project 1 value = true
it will be also set to true in project 2.
b) local font is a font specify for one function, then it will change back.
And how to recognize if a string includes letters, and remove the space befor text
A simple for
loop and string.sub
would work. You could also use gmatch
.
For your project1, project 2 question, set a global variable that both programs can use.
A) How to set a font local?
b) Not really understanding the project 1,2 => What global variables??
c) An example please for this. (String)
@TokOut What I meant for project 1,2 was saveGlobalData(“variableName”,value) and readGlobalData(“variableName”). Both programs can read and save the same variable.
@TokOut If I understood you right, this removes spaces if a string contains letters.
function setup()
str="this string contains both numbers and letters 12345 qwerty 67890 "
print(str)
-- remove leading spaces if there are letters in the string
letters=false
for z=1,#str do
c=string.sub(str,z,z)
if c>="a" and c<="z" or c>="A" and c<="Z" then -- check for letters
letters=true
break
end
end
if letters then
str1=""
for z=1,#str do
c=string.sub(str,z,z)
if c~=" " then -- check for a space
str1=str1..c
end
end
str=str1
end
print(str)
end
Second answer ^
I mean if a string contains letters before the text, so
. Any text here
=> Any text here
(The dot is only placeholder. Ignore the dot.)
This code will remove leading spaces before the first word.
function setup()
str=" This string has a lot of leading spaces before the first word."
print(str)
for _,str in string.gmatch(str,"(%s*)(.+)") do
print(str)
end
end
Thank you.