Add getDescription function (was missing)
The `getDescription(triggerId)` function, documented at: https://kwaroran.github.io/docs/srp/lua/#getdescriptiontriggerid was missing from the codebase and has now been added.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user