Начинающий
А без setmetatable можно?Чет много кода у тебя получилосьcode_language.lua:local drag_system = {} function drag_system:new(start_position, end_position) local private = {} private.dragging = false private.start_offset = vector(0, 0) private.end_offset = vector(0, 0) private.data = { start_position = start_position, end_position = end_position, } function private.in_bounds(source_vector, start_vector, end_vector) if (source_vector.x > start_vector.x and source_vector.y > start_vector.y) and (source_vector.x < end_vector.x and source_vector.y < end_vector.y) then return true end return false end local public = {} function public:get_data() return private.data end --This function must be called in render callback function public:instance() local mouse_position = ui.get_mouse_position() if common.is_button_down(0x1) then if private.in_bounds(mouse_position, private.data.start_position, private.dataend_position) or private.dragging then if not private.dragging then private.start_offset = mouse_position - private.data.start_position private.end_offset = mouse_position - private.data.end_position private.dragging = true end private.data.start_position = mouse_position - private.start_offset private.data.end_position = mouse_position - private.end_offset end elseif private.dragging then private.dragging = false end end setmetatable(public, self) self.__index = self return public end