forth-stuff/Dictionary.tl

19 lines
357 B
Plaintext
Raw Normal View History

2021-05-11 06:55:13 +00:00
local WordInfo = require("WordInfo")
2021-05-10 06:23:32 +00:00
2021-05-11 06:01:38 +00:00
2021-05-11 06:55:13 +00:00
local type Dictionary = record
2021-05-11 06:01:38 +00:00
contents: {string: WordInfo}
2021-05-10 06:23:32 +00:00
end
2021-05-11 06:01:38 +00:00
function Dictionary:define(word: string, info: WordInfo)
self.contents[word] = info
end
local dict_mt = {__index = Dictionary}
function Dictionary:new(): Dictionary
return setmetatable({contents = {}} as Dictionary, dict_mt)
end
2021-05-11 06:55:13 +00:00
return Dictionary