How would I do this?

Hello, hope you are doing well.

I was working on a Lua obfuscator as a little project for myself, but I ran into an issue very quickly.

Let’s say I have the code:

print("Hello world!")

and I wanted to encrypt the string to bytecode. How would I go through a line, check if there is a string, if there is, encrypt it? I have an idea for a single string on a line, but I’m not sure how I would work multiple strings or strings with double quotes/single quotes in them.

Best regards,
somejtohguyman

1 Like

Hi!

Here’s a script to check if a variable is a string:

local function checker(var) --create function that receives a variable
	
	if typeof(var) == "string" then --checks if variable is a string
		
		return var .. "is a string!" --return result
		
	else
		
		return var.Name .. "is not a string!"
		
	end
	
end

local var1 = "words"
local var2 = workspace.Part

possibleString1 = checker(var1) --call function and send variable 'var1'
possibleString2 = checker(var2) --call function and send variable 'var2'

print(possibleString1) --print results
print(possibleString2)

Results:

words is a string!
Part is not a string!

I don’t know how to convert to bytes, though. Maybe you can find it elsewhere on the forum, or someone else decides to be a helpful person!

Have a good day!

I’ve got the convert-to-byte part down, but I sadly can’t use the above code. My program will be structured like this:

local code = [[
print("Hello world!")
]]

use type for this, its faster and string is a Lua Datatype.

1 Like

Post closed. I have given up on this obfuscator.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.