git @ Cat's Eye Technologies Decoy / master src / decoy / model / symbol.lua
master

Tree @master (Download .tar.gz)

symbol.lua @masterraw · history · blame

--
-- decoy_model_symbol.lua
--

-- SPDX-FileCopyrightText: Copyright (c) 2023-2024 Chris Pressey, Cat's Eye Technologies.
-- This work is distributed under a 2-clause BSD license. For more information, see:
-- SPDX-License-Identifier: LicenseRef-BSD-2-Clause-X-Decoy

local Symbol = {}

function Symbol:text()
    return self._text
end

Symbol.new = function(contents)
    local self = {
        _text = contents,
    }
    setmetatable(self, {__index = Symbol})
    return self
end

Symbol.is_class_of = function(obj)
    local mt = getmetatable(obj)
    return mt and mt.__index == Symbol
end

return Symbol