Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0301· OpenAIAi2 WildChat-4.8M (AI2)

напиши на луа код который из каждой строки текстовой переменной берет за образец текст…

  1. User

    напиши на луа код который из каждой строки текстовой переменной берет за образец текст до символа = и если находит другую строку среди всех остальных в текстовой переменной то удаляет обе строки содержащих этот образец. образец текста для переменной "(E) (C) (M) buckle_lying = -1 (E) (C) (M) buckle_movable = 0 (E) (C) (M) buckle_require_restraints = 0 (E) (C) (M) burning = null (E) (C) (M) burn_point = null (E) (C) (M) cached_transform = null (E) (C) (M) canremove = 1 (E) (C) (M) canSmoothWith = null (E) (C) (M) can_be_holstered = 0 (E) (C) (M) can_be_placed_into = /list (8) 1 = /obj/structure/table 2 = /obj/structure/rack 3 = /obj/structure/closet 4 = /obj/item/weapon/storage 5 = /obj/structure/safe 6 = /obj/machinery/disposal 7 = /obj/machinery/r_n_d/destructive_analyzer 8 = /obj/machinery/autolathe (E) (C) (M) canSmoothWith = 1 (E) (C) (M) burning = 0 "

  2. Assistant

    local text = "(E) (C) (M) buckle_lying = -1\n(E) (C) (M) buckle_movable = 0\n(E) (C) (M) buckle_require_restraints = 0\n(E) (C) (M) burning = null\n(E) (C) (M) burn_point = null\n(E) (C) (M) cached_transform = null\n(E) (C) (M) canremove = 1\n(E) (C) (M) canSmoothWith = null\n(E) (C) (M) can_be_holstered = 0\n(E) (C) (M) can_be_placed_into = /list (8)\n1 = /obj/structure/table\n2 = /obj/structure/rack\n3 = /obj/structure/closet\n4 = /obj/item/weapon/storage\n5 = /obj/structure/safe\n6 = /obj/machinery/disposal\n7 = /obj/machinery/r_n_d/destructive_analyzer\n8 = /obj/machinery/autolathe\n(E) (C) (M) canSmoothWith = 1\n(E) (C) (M) burning = 0"

    local pattern = "%a+_%a+"

    for line in text:gmatch("[^\n]+") do local match = line:match(pattern) if match then for otherLine in text:gmatch("[^\n]+") do if otherLine ~= line and otherLine:find(match) then text = text:gsub(otherLine .. "\n","") text = text:gsub(line .. "\n","") end end end end

    print(text)