Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

[SOLVED] How do I convert a stringvalue's value to readable characters (byte() and char())?

So i've been testing for a few hours now and I cannot seem to get this to work, ill read and respond in the morning because its currently 5 am.

[all in 1 script]

--USAGE--

--For every function, put a space between the (): and the last character of the function (before the ():)--

local aaaa = require(script.Parent.Py2Lua)
local code = [[
print("Hello, world!")
]]
local function convertJUNKtoCODE(junk)
	myothertable = {}
	tempValue2 = Instance.new("StringValue")
	tempValue2.Name = "TEemP2"
	tempValue2.Parent = script.Parent:FindFirstChild("Py To Lua Wrapper")
	junk = junk
	for i=1, junk:len() do
		local tempresult = junk:sub(i,i):char()
		local finalize = aaaa.join(tempresult," ")
		local tablet = table.insert(mytable,tempresult)
		tempValue2.Value = table.concat(mytable,"")
	end
	return tempValue2.Value
end
function convertCODEtoJUNK(code)
	mytable = {}
	tempValue = Instance.new("StringValue")
	tempValue.Name = "TEemP"
	tempValue.Parent = script.Parent:FindFirstChild("Py To Lua Wrapper")
	code = code
	for i=1, code:len() do
		local tempresult = code:sub(i,i):byte()
		local finalize = aaaa.join(tempresult," ")
		local tablet = table.insert(mytable,tempresult)
		tempValue.Value = table.concat(mytable,", ")
	end
	return tempValue.Value
end
script.C2J.Value = convertCODEtoJUNK(code)
wait(0.5)
print(convertJUNKtoCODE(tonumber(script.C2J.Value)))

module script

function Python.join(text,seprator)
	if seprator == nil then 
		return string.gsub(text, "%s+", "")
	else
		charCount = string.len(seprator)
		if charCount ~= 1 then
			return print("might add multi character seprator support at some point")
		elseif charCount == 1 then
			return string.gsub(text, "%s+", seprator)
		end
	end
end

edit: solved it

3 comments

0

I'm sorry but what is your goal again? I don't understand much.

0

im awake now, so ill answer. the first script provides the error "attempt to index nil with "len"' on line 15, i posted a part of the module script just incase if there was something wrong with that too

0

still waiting for a answer/solution

1 answer

solved it, used the wrong table and line 33's seperator was changed to nothing. also removed tonumber()

This discussion is preserved as it was. New answers, comments, and votes are closed.