Posted 08 June 2014 - 02:58 AM
I have a table of variable names and variables already set, such as:
hash_startup="43ff582a012f27323c5249e64e28291a077ffd7949a074f2a80b5867ffdbe3f7"
hash_fileexplorer="5670803cddda0e5a34496cf33a0b21782fa80ea653a472fdee67d421cb0060c2"
hash_deletefile="b99fd5065b9f95a4487f25d1522f8d85ca24a87e7f71523a6f9ce1922cf914ac"
local randomTable={"startup",
"fileexplorer",
"deletefile"}
Assuming I couldn't just do "local newVar1=hash_startup", is there anyway to take the value of "randomTable[1]" and convert it to a variable? If you didn't understand the previous sentence, suppose I was trying to have a table with 25+ strings inside and wanted to compare the hash of startup and the value in hash_startup, how should I revise this?
for i=1, #randomTable do
local fileRead=fs.open(randomTable[i], "r")
local hash=sha256(fileRead.readAll())
fileRead.close()
if hash~="hash_"..randomTable[i] then
print("HASH DOES NOT MATCH")
end
end
Edited on 08 June 2014 - 12:59 AM