feat: alertSelect for triggerlua (#844)

# PR Checklist
- [ ] Have you checked if it works normally in all models? *Ignore this
if it doesn't use models.*
- [ ] Have you checked if it works normally in all web, local, and node
hosted versions? If it doesn't, have you blocked it in those versions?
- [x] Have you added type definitions?

# Description
This PR aims to make the alertSelect trigger usable in Lua as well.

Here is the Lua code used for testing:
```Lua
testSelect = async(function(id)
  -- declare string table
  local strTable = {
    "test1",
    "test2",
    "test3",
    "test4",
    "test5",
  }
  local testVar = alertSelect(id, strTable):await()
  print('testVar')
  print(testVar)
end)
```
This commit is contained in:
kwaroran
2025-05-10 20:14:59 +09:00
committed by GitHub

View File

@@ -3,7 +3,7 @@ import { LuaEngine, LuaFactory } from "wasmoon";
import { getCurrentCharacter, getCurrentChat, getDatabase, setCurrentChat, setDatabase, type Chat, type character, type groupChat } from "../storage/database.svelte";
import { get } from "svelte/store";
import { ReloadGUIPointer, selectedCharID } from "../stores.svelte";
import { alertError, alertInput, alertNormal } from "../alert";
import { alertSelect, alertError, alertInput, alertNormal } from "../alert";
import { HypaProcesser } from "./memory/hypamemory";
import { generateAIImage } from "./stableDiff";
import { writeInlayImage } from "./files/inlays";
@@ -107,6 +107,12 @@ export async function runLua(code:string, arg:{
}
return alertInput(value)
})
luaEngine.global.set('alertSelect', (id:string, value:string[]) => {
if(!LuaSafeIds.has(id)){
return
}
return alertSelect(value)
})
luaEngine.global.set('setChat', (id:string, index:number, value:string) => {
if(!LuaSafeIds.has(id)){
return