Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 1 year ago
Edited by Xapelize 1 year ago

This question has been solved by the original poster.

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

0
I'm sorry but what is your goal again? I don't understand much. T3_MasterGamer 2189 — 1y
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 ObedientMase 0 — 1y
0
still waiting for a answer/solution ObedientMase 0 — 1y

1 answer

Log in to vote
0
Answered by 1 year ago

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

Ad

Answer this question