conlang-heonian/add_word.lua
2022-06-06 07:13:30 +02:00

47 lines
976 B
Lua

function addWord()
number = tonumber(number)
-- open file
local file = io.open(data_get, "r")
local pos = 0
-- all this is old code, not useful now, but still in case i need it <:
-- get insertion point
pos = file:seek("end")
-- store after
local after = file:read("*all")
-- store before
file:seek("set")
local before = file:read(pos-1)
-- done reading
file:close()
modify = {}
print("insert new phonetics:")
modify[1] = io.read()
print("insert new meaning:")
modify[2] = io.read()
print("insert new type:")
modify[3] = io.read()
print("insert new canon origin:")
modify[4] = io.read()
print("insert new meta origin:")
modify[5] = io.read()
print("insert new notes:")
modify[6] = io.read()
local file = io.open(data_output, "w+")
file:write(before)
file:write("\n")
for i=1, #modify do
if i > 1 then
file:write(" ")
end
file:write(modify[i])
end
file:write("")
file:write(after)
file:close()
end