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

Can you do string manipulation on a table?

I'm just trying to work out string.reverse, but it says attempted to index "string, a nil value"

This is what I have

local encryptThese = {}

function basicEncryption()
	for i,v in pairs(game.Workspace:GetChildren()) do
		if v.Parent == game.workspace then
			print(v)
			table.insert(encryptThese, v)
			encryptThese.string.reverse()
		end
	end
end

basicEncryption()

1 comment

0

You can also call it with : For example local a = "ABCD" print(a:reverse()) prints DCBA.

2 answers

✓ Accepted answer

string.reverse is used like this:

string.reverse("test") --> tset

2 comments

0

Yea, I figured that out eventually. Thanks though :)

0

You're welcome. lol

No, but you can set them like this.

local atable = {'Hello', 'from', 'hiimgoodpack!'}
for i = 1, #atable do
	atable[i] = string.reverse(atable[i])
end

This will turn the table keys from Hello from hiimgoodpack! to olleH morf !kcapdoogmiih I hope this helps you in the future!

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