Spoiler
line = ["Sand"] = getAEId(12, 0), "Sand", "Sand"
function getAEId(id, meta)
return meta*32768 + id
end
function getIdMeta(lineStr)
local firstParenth = string.find(lineStr, "%(")
print(firstParenth)
local secondParenth = string.find(lineStr, "%)")
print(secondParenth)
local insideParenth = string.sub(lineStr, firstParenth, secondParenth)
local comma, _ = string.find(insideParenth, ",")
print(insideParenth)
print(comma)
local id = string.sub(insideParenth, firstParenth+1, comma-1)
print(id)
local meta = string.sub(insideParenth, comma, #insideParenth)
print(meta)
print(getAEId(id, meta))
end
for line in io.open("itemListTemp.lua"):lines() do -- Line is shown above. ignore the for loop.
if string.find(string.lower(line), "sand") then
print(line)
getIdMeta(tostring(line))
end
end
returns this
["Sand"] = getAEId(12, 0), "Sand", "Sand"
19
25
(12, 0) – this should equal 12
22 – this should be 3 (place of comma in insideParenth)
(12, 0) – this should equal 0
then errors on line 2, but I think I can handle that.