Вопросы по Lua скриптингу

Общая тема для вопросов по разработке скриптов на языке программирования Lua, в частности под MoonLoader.
  • Задавая вопрос, убедитесь, что его нет в списке частых вопросов и что на него ещё не отвечали (воспользуйтесь поиском).
  • Поищите ответ в теме посвященной разработке Lua скриптов в MoonLoader
  • Отвечая, убедитесь, что ваш ответ корректен.
  • Старайтесь как можно точнее выразить мысль, а если проблема связана с кодом, то обязательно прикрепите его к сообщению, используя блок [code=lua]здесь мог бы быть ваш код[/code].
  • Если вопрос связан с MoonLoader-ом первым делом желательно поискать решение на wiki.

Частые вопросы

Как научиться писать скрипты? С чего начать?
Информация - Гайд - Всё о Lua скриптинге для MoonLoader(https://blast.hk/threads/22707/)
Как вывести текст на русском? Вместо русского текста у меня какие-то каракули.
Изменить кодировку файла скрипта на Windows-1251. В Atom: комбинация клавиш Ctrl+Shift+U, в Notepad++: меню Кодировки -> Кодировки -> Кириллица -> Windows-1251.
Как получить транспорт, в котором сидит игрок?
Lua:
local veh = storeCarCharIsInNoSave(PLAYER_PED)
Как получить свой id или id другого игрока?
Lua:
local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED) -- получить свой ид
local _, id = sampGetPlayerIdByCharHandle(ped) -- получить ид другого игрока. ped - это хендл персонажа
Как проверить, что строка содержит какой-то текст?
Lua:
if string.find(str, 'текст', 1, true) then
-- строка str содержит "текст"
end
Как эмулировать нажатие игровой клавиши?
Lua:
local game_keys = require 'game.keys' -- где-нибудь в начале скрипта вне функции main

setGameKeyState(game_keys.player.FIREWEAPON, -1) -- будет сэмулировано нажатие клавиши атаки
Все иды клавиш находятся в файле moonloader/lib/game/keys.lua.
Подробнее о функции setGameKeyState здесь: lua - setgamekeystate | BlastHack — DEV_WIKI(https://www.blast.hk/wiki/lua:setgamekeystate)
Как получить id другого игрока, в которого целюсь я?
Lua:
local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE) -- получить хендл персонажа, в которого целится игрок
if valid and doesCharExist(ped) then -- если цель есть и персонаж существует
  local result, id = sampGetPlayerIdByCharHandle(ped) -- получить samp-ид игрока по хендлу персонажа
  if result then -- проверить, прошло ли получение ида успешно
    -- здесь любые действия с полученным идом игрока
  end
end
Как зарегистрировать команду чата SAMP?
Lua:
-- До бесконечного цикла/задержки
sampRegisterChatCommand("mycommand", function (param)
     -- param будет содержать весь текст введенный после команды, чтобы разделить его на аргументы используйте string.match()
    sampAddChatMessage("MyCMD", -1)
end)
Крашит игру при вызове sampSendChat. Как это исправить?
Это происходит из-за бага в SAMPFUNCS, когда производится попытка отправки пакета определенными функциями изнутри события исходящих RPC и пакетов. Исправления для этого бага нет, но есть способ не провоцировать его. Вызов sampSendChat изнутри обработчика исходящих RPC/пакетов нужно обернуть в скриптовый поток с нулевой задержкой:
Lua:
function onSendRpc(id)
  -- крашит:
  -- sampSendChat('Send RPC: ' .. id)

  -- норм:
  lua_thread.create(function()
    wait(0)
    sampSendChat('Send RPC: ' .. id)
  end)
end
 
Последнее редактирование:

Fomikus

Известный
Проверенный
474
342
Lua:
<div class="map-icon business-state-8 business-not-sale" style="top:984.888px;left:941.849px;background:url(/images/business_0.gif)" title="" data-toggle="tooltip" data-html="true" data-original-title="<div class='text-center'>Аренда транспорта</div>"></div><div class="map-icon business-state-2 business-not-sale" style="top:554.411px;left:1001.988px;background:url(/images/business_0.gif)" title="" data-toggle="tooltip" data-html="true" data-original-title="<div class='text-center'>Магазин 24/7</div>"></div>
<div class="map-icon business-state-8 business-not-sale" style="top:984.888px;left:941.849px;background:url(/images/business_0.gif)" title="" data-toggle="tooltip" data-html="true" data-original-title="<div class='text-center'>Аренда транспорта</div>"></div><div class="map-icon business-state-2 business-not-sale" style="top:554.411px;left:1001.988px;background:url(/images/business_0.gif)" title="" data-toggle="tooltip" data-html="true" data-original-title="<div class='text-center'>Магазин 24/7</div>"></div>

Как сделать цикл для каждого класса, название которого начинается на map-icon
Обычные регулярки возвращают текст между началом класса и последним </div>
Нужно чтобы вернул параметры внутри класса(В примере их два)
Первое -
business-state-8 business-not-sale" style="top:984.888px;left:941.849px;background:url(/images/business_0.gif)" title="" data-toggle="tooltip" data-html="true" data-original-title="<div class='text-center'>Аренда транспорта</div>"></div>

Второе -
business-state-2 business-not-sale" style="top:554.411px;left:1001.988px;background:url(/images/business_0.gif)" title="" data-toggle="tooltip" data-html="true" data-original-title="<div class='text-center'>Магазин 24/7</div>"></div>
Ну или гайд где взять HTML Parser для lua
 

morti.

Участник
63
3
Написал луа который выводит информацию диалога в чат, но не работает, вот лог из moonloader.log
Код:
[00:53:19.758870] (error)    for rio.lua: D:\Games\ARIZONA GAMES\bin\Arizona\moonloader\for rio.lua:2: attempt to call global 'require' (a string value)
stack traceback:
    D:\Games\ARIZONA GAMES\bin\Arizona\moonloader\for rio.lua:2: in main chunk

Код луашника:
Lua:
require = 'lib.moonloader'
local sampev = require 'lib.samp.events'
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    while true do
      wait(0)
    end
end

  
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
sampAddChatMessage(dialogId, -1 )
sampAddChatMessage(style, -1)
sampAddChatMessage(title, -1)
sampAddChatMessage(button1, -1)
sampAddChatMessage(button2, -1)
sampAddChatMessage(text, -1)
 end

Самое забавное, что если первым поставить local sampev = require 'lib.samp.events', а require = 'lib.moonloader' вторым, то все работает. Возникает вопрос, почему не работает вышесказанный код? Почему нужно переставлять местами sampev и require?
 

ROBERT PUSHER

Известный
305
212
Написал луа который выводит информацию диалога в чат, но не работает, вот лог из moonloader.log
Код:
[00:53:19.758870] (error)    for rio.lua: D:\Games\ARIZONA GAMES\bin\Arizona\moonloader\for rio.lua:2: attempt to call global 'require' (a string value)
stack traceback:
    D:\Games\ARIZONA GAMES\bin\Arizona\moonloader\for rio.lua:2: in main chunk

Код луашника:
Lua:
require = 'lib.moonloader'
local sampev = require 'lib.samp.events'
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    while true do
      wait(0)
    end
end


function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
sampAddChatMessage(dialogId, -1 )
sampAddChatMessage(style, -1)
sampAddChatMessage(title, -1)
sampAddChatMessage(button1, -1)
sampAddChatMessage(button2, -1)
sampAddChatMessage(text, -1)
end

Самое забавное, что если первым поставить local sampev = require 'lib.samp.events', а require = 'lib.moonloader' вторым, то все работает. Возникает вопрос, почему не работает вышесказанный код? Почему нужно переставлять местами sampev и require?
Зачем ты подключаешь moonloader? В коде он тебе не нужен, проверки на инициализацию можно сократить доrepeat wait(0) until isSampAvailable() and isSampfuncsLoaded(), а while true do wait(0) на wait(-1),ошибка в том, что ты неправильно подключаешь мун, require('moonloader')
 

kizn

О КУ)))
Всефорумный модератор
2,405
2,060
Написал луа который выводит информацию диалога в чат, но не работает, вот лог из moonloader.log
Код:
[00:53:19.758870] (error)    for rio.lua: D:\Games\ARIZONA GAMES\bin\Arizona\moonloader\for rio.lua:2: attempt to call global 'require' (a string value)
stack traceback:
    D:\Games\ARIZONA GAMES\bin\Arizona\moonloader\for rio.lua:2: in main chunk

Код луашника:
Lua:
require = 'lib.moonloader'
local sampev = require 'lib.samp.events'
function main()
    if not isSampLoaded() or not isSampfuncsLoaded() then return end
    while not isSampAvailable() do wait(100) end
    while true do
      wait(0)
    end
end

 
function sampev.onShowDialog(dialogId, style, title, button1, button2, text)
sampAddChatMessage(dialogId, -1 )
sampAddChatMessage(style, -1)
sampAddChatMessage(title, -1)
sampAddChatMessage(button1, -1)
sampAddChatMessage(button2, -1)
sampAddChatMessage(text, -1)
end

Самое забавное, что если первым поставить local sampev = require 'lib.samp.events', а require = 'lib.moonloader' вторым, то все работает. Возникает вопрос, почему не работает вышесказанный код? Почему нужно переставлять местами sampev и require?
require без равно нужно делать либо в скобках

require("moonloader")
local sampev = require "samp.events"
 

Мира

Участник
455
9
как взаимодействовать со своими координатами и координатами других игроков? то есть допустим я вхожу определённые координаты и всех тех, кто входит на территорию в 5 метров от себя выводятся их id и поочерёдно взаимодействует с ними
 

Smeruxa

Известный
1,305
684
как взаимодействовать со своими координатами и координатами других игроков? то есть допустим я вхожу определённые координаты и всех тех, кто входит на территорию в 5 метров от себя выводятся их id и поочерёдно взаимодействует с ними
getDistanceBetweenCoords3d
 

ewin

Известный
675
369
как можно сделать "псевдочат"? получаю какой-то текст, рендерю его, приходит новый текст и тогда первый немного смещается ниже, а второй над ним
 

Corrygаn

Участник
225
6
[ML] (error) Goses.lua: D:\ARIZONA GAMES\bin\Scripts\moonloader\Goses.lua:312: stack index 3, expected number, received nil: not a numeric type or numeric string (bad argument into 'void(int)')
stack traceback:
[C]: in function '__newindex'
D:\ARIZONA GAMES\bin\Scripts\moonloader\Goses.lua:312: in function 'iniLoad'
D:\ARIZONA GAMES\bin\Scripts\moonloader\Goses.lua:394: in function <D:\ARIZONA GAMES\bin\Scripts\moonloader\Goses.lua:390>
[ML] (error) Goses.lua: Script died due to an error. (08FFBE14)
При чём тут плохой аргумент? :D
Lua:
local intImGui = imgui.ImInt(0)
local colorsImGui = {u8"Чёрно-зелёный", u8"Чёрно-синий", u8"Чёрно-красный", u8"Черно-коричневый", u8"Монохром", u8"Бело-голубой", u8"Чёрно-голубой", u8"Чёрно-оранжевый"}

function iniLoad()
-----code
        intImGui.v = configuration.other.colortheme --та самая строка с плохим аргументом :D
        print('[ Загрузка конфигурационных файлов... ]')
    end
end

--OnDrawFrame()
        if intImGui.v == 0 then
        apply_custom_style1()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 1 then
        apply_custom_style2()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 2 then
        apply_custom_style3()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 3 then
        apply_custom_style4()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 4 then
        apply_custom_style5()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 5 then
        apply_custom_style6()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 6 then
        apply_custom_style7()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 7 then
        apply_custom_style8()
        configuration_path.colortheme = intImGui.v
        iniSave()
    end
    imgui.Combo(u8"Стиль интерфейса", intImGui, colorsImGui)
 

kizn

О КУ)))
Всефорумный модератор
2,405
2,060
[ML] (error) Goses.lua: D:\ARIZONA GAMES\bin\Scripts\moonloader\Goses.lua:312: stack index 3, expected number, received nil: not a numeric type or numeric string (bad argument into 'void(int)')
stack traceback:
[C]: in function '__newindex'
D:\ARIZONA GAMES\bin\Scripts\moonloader\Goses.lua:312: in function 'iniLoad'
D:\ARIZONA GAMES\bin\Scripts\moonloader\Goses.lua:394: in function <D:\ARIZONA GAMES\bin\Scripts\moonloader\Goses.lua:390>
[ML] (error) Goses.lua: Script died due to an error. (08FFBE14)
При чём тут плохой аргумент? :D
Lua:
local intImGui = imgui.ImInt(0)
local colorsImGui = {u8"Чёрно-зелёный", u8"Чёрно-синий", u8"Чёрно-красный", u8"Черно-коричневый", u8"Монохром", u8"Бело-голубой", u8"Чёрно-голубой", u8"Чёрно-оранжевый"}

function iniLoad()
-----code
        intImGui.v = configuration.other.colortheme --та самая строка с плохим аргументом :D
        print('[ Загрузка конфигурационных файлов... ]')
    end
end

--OnDrawFrame()
        if intImGui.v == 0 then
        apply_custom_style1()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 1 then
        apply_custom_style2()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 2 then
        apply_custom_style3()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 3 then
        apply_custom_style4()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 4 then
        apply_custom_style5()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 5 then
        apply_custom_style6()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 6 then
        apply_custom_style7()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 7 then
        apply_custom_style8()
        configuration_path.colortheme = intImGui.v
        iniSave()
    end
    imgui.Combo(u8"Стиль интерфейса", intImGui, colorsImGui)
дай таблицу configuration
 

Corrygаn

Участник
225
6
дай таблицу configuration
дай таблицу configuration
Lua:
function iniReset()
    inicfg.save({
        mvd = {
            stmvdgov = '',
            ndmvdgov = '',
            rdmvdgov = '',
            mvdtag = '',
            mvdtime = '',
        },
        mo = {
            stmogov = '',
            ndmogov = '',
            rdmogov = '',
            motag = '',
            motime = '',
        },
        smi = {
            stsmigov = '',
            ndsmigov = '',
            rdsmigov = '',
            smitag = '',
            smitime = '',
        },
        mz = {
            stmzgov = '',
            ndmzgov = '',
            rdmzgov = '',
            mztag = '',
            mztime = '',
        },
        cb = {
            stcbgov = '',
            ndcbgov = '',
            rdcbgov = '',
            cbtag = '',
            cbtime = '',
        },
        gv = {
            stgvgov = '',
            ndgvgov = '',
            rdgvgov = '',
            gvtag = '',
            gvtime = '',
        },
        other = {
            colortheme = "",
        }
    }, configuration_path)

    print('[ Создание конфигурационных файлов... ]')
end

function iniLoad()
    print('[ Проверка конфигурационных файлов... ]')
    configuration = inicfg.load(nil, configuration_path)

    if configuration == nil then
        iniReset()
    else
        text_buffermvd1.v = configuration.mvd.stmvdgov
        text_buffermvd2.v = configuration.mvd.ndmvdgov
        text_buffermvd3.v = configuration.mvd.rdmvdgov
        text_buffertagmvd.v = configuration.mvd.mvdtag
        mvd_time.v = configuration.mvd.mvdtime
        text_buffermo1.v = configuration.mo.stmogov
        text_buffermo2.v = configuration.mo.ndmogov
        text_buffermo3.v = configuration.mo.rdmogov
        text_buffertagmo.v = configuration.mo.motag
        mo_time.v = configuration.mo.motime
        text_buffersmi1.v = configuration.smi.stsmigov
        text_buffersmi2.v = configuration.smi.ndsmigov
        text_buffersmi3.v = configuration.smi.rdsmigov
        text_buffertagsmi.v = configuration.smi.smitag
        smi_time.v = configuration.smi.smitime
        text_buffermz1.v = configuration.mz.stmzgov
        text_buffermz2.v = configuration.mz.ndmzgov
        text_buffermz3.v = configuration.mz.rdmzgov
        text_buffertagmz.v = configuration.mz.mztag
        mz_time.v = configuration.mz.mztime
        text_buffercb1.v = configuration.cb.stcbgov
        text_buffercb2.v = configuration.cb.ndcbgov
        text_buffercb3.v = configuration.cb.rdcbgov
        text_buffertagcb.v = configuration.cb.cbtag
        cb_time.v = configuration.cb.cbtime
        text_buffergv1.v = configuration.gv.stgvgov
        text_buffergv2.v = configuration.gv.ndgvgov
        text_buffergv3.v = configuration.gv.rdgvgov
        text_buffertaggv.v = configuration.gv.gvtag
        gv_time.v = configuration.gv.gvtime
        intImGui.v = configuration.other.colortheme
        print('[ Загрузка конфигурационных файлов... ]')
    end
end

function iniSave()
    inicfg.save({
        mvd = {
            stmvdgov = text_buffermvd1.v,
            ndmvdgov = text_buffermvd2.v,
            rdmvdgov = text_buffermvd3.v,
            mvdtag = text_buffertagmvd.v,
            mvdtime = mvd_time.v, 
        },
        mo = {
            stmogov = text_buffermo1.v,
            ndmogov = text_buffermo2.v,
            rdmogov = text_buffermo3.v,
            motag = text_buffertagmo.v,
            motime = mo_time.v,
        },
        smi = {
            stsmigov = text_buffersmi1.v,
            ndsmigov = text_buffersmi2.v,
            rdsmigov = text_buffersmi3.v,
            smitag = text_buffertagsmi.v,
            smitime = smi_time.v,
        },
        mz = {
            stmzgov = text_buffermz1.v,
            ndmzgov = text_buffermz2.v,
            rdmzgov = text_buffermz3.v,
            mztag = text_buffertagmz.v,
            mztime = mz_time.v,
        },
        cb = {
            stcbgov = text_buffercb1.v,
            ndcbgov = text_buffercb2.v,
            rdcbgov = text_buffercb3.v,
            cbtag = text_buffertagcb.v,
            cbtime = cb_time.v,
        },
        gv = {
            stgvgov = text_buffergv1.v,
            ndgvgov = text_buffergv2.v,
            rdgvgov = text_buffergv3.v,
            gvtag = text_buffertaggv.v,
            gvtime = gv_time.v,
        },
        other = {
            colortheme = intImGui.v,
        }
    }, configuration_path)

    print('[ Сохранение настроек... ]')
end
 

kizn

О КУ)))
Всефорумный модератор
2,405
2,060
так ты в int отдаешь строку (colortheme у тебя "", а intImgui это число)
 

Corrygаn

Участник
225
6
ну colortheme сделай цифрой, а не строкой
Сделал, теперь новая ошибка.
[ML] (error) Goses.lua: D:\ARIZONA GAMES\bin\Scripts\moonloader\Goses.lua:1049: attempt to index field 'other' (a nil value)
stack traceback:
D:\ARIZONA GAMES\bin\Scripts\moonloader\Goses.lua:1049: in function 'OnDrawFrame'
D:\ARIZONA GAMES\bin\Scripts\moonloader\lib\imgui.lua:1378: in function <D:\ARIZONA GAMES\bin\Scripts\moonloader\lib\imgui.lua:1367>
[ML] (error) Goses.lua: Script died due to an error. (10F479E4)
Lua:
function iniReset()
    inicfg.save({
        mvd = {
            stmvdgov = '',
            ndmvdgov = '',
            rdmvdgov = '',
            mvdtag = '',
            mvdtime = '',
        },
        mo = {
            stmogov = '',
            ndmogov = '',
            rdmogov = '',
            motag = '',
            motime = '',
        },
        smi = {
            stsmigov = '',
            ndsmigov = '',
            rdsmigov = '',
            smitag = '',
            smitime = '',
        },
        mz = {
            stmzgov = '',
            ndmzgov = '',
            rdmzgov = '',
            mztag = '',
            mztime = '',
        },
        cb = {
            stcbgov = '',
            ndcbgov = '',
            rdcbgov = '',
            cbtag = '',
            cbtime = '',
        },
        gv = {
            stgvgov = '',
            ndgvgov = '',
            rdgvgov = '',
            gvtag = '',
            gvtime = '',
        },
        other = {
            colortheme = 1,
        }
    }, configuration_path)
    print('[ Создание конфигурационных файлов... ]')
end
function iniLoad()
    print('[ Проверка конфигурационных файлов... ]')
    configuration = inicfg.load(nil, configuration_path)
    if configuration == nil then
        iniReset()
    else
        text_buffermvd1.v = configuration.mvd.stmvdgov
        text_buffermvd2.v = configuration.mvd.ndmvdgov
        text_buffermvd3.v = configuration.mvd.rdmvdgov
        text_buffertagmvd.v = configuration.mvd.mvdtag
        mvd_time.v = configuration.mvd.mvdtime
        text_buffermo1.v = configuration.mo.stmogov
        text_buffermo2.v = configuration.mo.ndmogov
        text_buffermo3.v = configuration.mo.rdmogov
        text_buffertagmo.v = configuration.mo.motag
        mo_time.v = configuration.mo.motime
        text_buffersmi1.v = configuration.smi.stsmigov
        text_buffersmi2.v = configuration.smi.ndsmigov
        text_buffersmi3.v = configuration.smi.rdsmigov
        text_buffertagsmi.v = configuration.smi.smitag
        smi_time.v = configuration.smi.smitime
        text_buffermz1.v = configuration.mz.stmzgov
        text_buffermz2.v = configuration.mz.ndmzgov
        text_buffermz3.v = configuration.mz.rdmzgov
        text_buffertagmz.v = configuration.mz.mztag
        mz_time.v = configuration.mz.mztime
        text_buffercb1.v = configuration.cb.stcbgov
        text_buffercb2.v = configuration.cb.ndcbgov
        text_buffercb3.v = configuration.cb.rdcbgov
        text_buffertagcb.v = configuration.cb.cbtag
        cb_time.v = configuration.cb.cbtime
        text_buffergv1.v = configuration.gv.stgvgov
        text_buffergv2.v = configuration.gv.ndgvgov
        text_buffergv3.v = configuration.gv.rdgvgov
        text_buffertaggv.v = configuration.gv.gvtag
        gv_time.v = configuration.gv.gvtime
        intImGui.v = configuration.other.colortheme
        print('[ Загрузка конфигурационных файлов... ]')
    end
end
function iniSave()
    inicfg.save({
        mvd = {
            stmvdgov = text_buffermvd1.v,
            ndmvdgov = text_buffermvd2.v,
            rdmvdgov = text_buffermvd3.v,
            mvdtag = text_buffertagmvd.v,
            mvdtime = mvd_time.v,
        },
        mo = {
            stmogov = text_buffermo1.v,
            ndmogov = text_buffermo2.v,
            rdmogov = text_buffermo3.v,
            motag = text_buffertagmo.v,
            motime = mo_time.v,
        },
        smi = {
            stsmigov = text_buffersmi1.v,
            ndsmigov = text_buffersmi2.v,
            rdsmigov = text_buffersmi3.v,
            smitag = text_buffertagsmi.v,
            smitime = smi_time.v,
        },
        mz = {
            stmzgov = text_buffermz1.v,
            ndmzgov = text_buffermz2.v,
            rdmzgov = text_buffermz3.v,
            mztag = text_buffertagmz.v,
            mztime = mz_time.v,
        },
        cb = {
            stcbgov = text_buffercb1.v,
            ndcbgov = text_buffercb2.v,
            rdcbgov = text_buffercb3.v,
            cbtag = text_buffertagcb.v,
            cbtime = cb_time.v,
        },
        gv = {
            stgvgov = text_buffergv1.v,
            ndgvgov = text_buffergv2.v,
            rdgvgov = text_buffergv3.v,
            gvtag = text_buffertaggv.v,
            gvtime = gv_time.v,
        },
        other = {
            colortheme = intImGui.v,
        }
    }, configuration_path)
    print('[ Сохранение настроек... ]')
end

function imgui.OnDrawFrame()
    if intImGui.v == 0 then
        apply_custom_style1()
        configuration_path.other.colortheme = intImGui.v -- здесь ошибка
        iniSave()
    elseif intImGui.v == 1 then
        apply_custom_style2()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 2 then
        apply_custom_style3()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 3 then
        apply_custom_style4()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 4 then
        apply_custom_style5()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 5 then
        apply_custom_style6()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 6 then
        apply_custom_style7()
        configuration_path.other.colortheme = intImGui.v
        iniSave()
    elseif intImGui.v == 7 then
        apply_custom_style8()
        configuration_path.colortheme = intImGui.v
        iniSave()
    end
end