diff --git a/src/ts/process/lua.ts b/src/ts/process/lua.ts index 074ba707..4d48850a 100644 --- a/src/ts/process/lua.ts +++ b/src/ts/process/lua.ts @@ -418,6 +418,19 @@ export async function runLua(code:string, arg:{ setDatabase(db) }) + luaEngine.global.set('getDescription', async (id:string) => { + if(!LuaSafeIds.has(id)){ + return + } + const db = getDatabase() + const selectedChar = get(selectedCharID) + const char = db.characters[selectedChar] + if(char.type === 'group'){ + throw('Character is a group') + } + return char.desc + }) + luaEngine.global.set('setDescription', async (id:string, desc:string) => { if(!LuaSafeIds.has(id)){ return @@ -972,4 +985,4 @@ export async function runLuaButtonTrigger(char:character|groupChat|simpleCharact throw(error) } return runResult -} \ No newline at end of file +}