Before you guys start yelling at me, yes. I did try the search and I have found answers, but they all seem to be for standard tables that don’t seem to work with mine. The problem with my array, is that it isn’t a proper array. It also has another set of arrays within the list.
How can I convert this string into a functional table?
Some help will be greatly appreciated as always!
local TextToConvert = "{1,1,1},{0,0,0},{1,1,1}"
-- What I want the end result to be:
local Table = {
{1,1,1},{0,0,0},{1,1,1}
}
loadstring is an inbuilt method in lua, which basically returns a function containing the code string you provided in its argument. For example:
loadstring("
local returnValue = 'Hello World!'
return returnValue
")
would return a function with a similar structure:
function()
local returnValue = 'Hello World!'
return returnValue
end
If you call the function, it would return Hello World!, because that’s what the code is like.
string:format(parameters) is basically just the short way of string.format("string", parameters). It’s basically like concatenation but better. I don’t really know how to explain this…
This would have been great to know before I started on my file data loader. Thanks!
i’ll give you this, your explanations are better than mine. I spent most of my time making this post from me trying to explain what I wanted to achieve. Sometimes I don’t even get past the requirements to post a bug report. But thanks for your help anyways.