Posted 18 April 2016 - 10:02 PM
I have some code:
But it keeps replacing 'n' from 'print' with 'NN'
Also, it leaves out the last 'NN'
Edit: oopsies. Put print(replace(':/NN/print/NN','"NyanOS"','"..OS.."'))
instead of :
print(replace(':/NN/print/NN','"NN"','"..OS.."'))
in my editing.
function replace(string, s, v)
string = tostring(string)
local t={}; i =1
for str in string.gmatch(string, "([^"..s.."]+)") do
table.insert(t, str)
end
string = t[1]
for k, x in ipairs(t) do
if k~=1 then
string = string..v..x
end
end
return string
end
print(replace(':/NN/print/NN','"NyanOS"','"..OS.."'))
But it keeps replacing 'n' from 'print' with 'NN'
Also, it leaves out the last 'NN'
Edit: oopsies. Put print(replace(':/NN/print/NN','"NyanOS"','"..OS.."'))
instead of :
print(replace(':/NN/print/NN','"NN"','"..OS.."'))
in my editing.
Edited on 19 April 2016 - 10:53 AM