Skip to content

Commit

Permalink
Fix missing parameters showing "undefined" instead of the parameter a…
Browse files Browse the repository at this point in the history
…nd index it's trying to access.
  • Loading branch information
Damnae committed Jan 9, 2024
1 parent ac20d47 commit 9234a2a
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/sources/gamecore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,14 +319,22 @@ function explainDynamicValue(value:DynamicValue, params:{[key:string]:GamecorePa
if (value?.ReadInfo)
{
const paramList = params[value.ReadInfo.Str]
const paramIndex = getIndexFromDynamicValueType(value.ReadInfo.Type)

if (!paramList)
console.log(`params not found: ${value.ReadInfo.Str}[${getIndexFromDynamicValueType(value.ReadInfo.Type)}]`)
const paramValue = cleanupNumber(paramList?.[getIndexFromDynamicValueType(value.ReadInfo.Type)]?.Value)
console.log(`params not found: ${value.ReadInfo.Str}[${paramIndex}]`)

const paramValue = paramList?.[paramIndex]?.Value
if (!paramValue)
console.log(`param not found: ${value.ReadInfo.Str}[${getIndexFromDynamicValueType(value.ReadInfo.Type)}]`)
console.log(`param value not found: ${value.ReadInfo.Str}[${paramIndex}]`)

var paramName = value.ReadInfo.Str
if (!paramName)
paramName = 'Param'

return `${value.ReadInfo.Str}(${paramValue})` ??
`${value.ReadInfo.Str}[${getIndexFromDynamicValueType(value.ReadInfo.Type)}]`
return paramValue ?
`${paramName}(${cleanupNumber(paramValue)})` :
`${paramName}[${paramIndex}]`
}
}

Expand Down

0 comments on commit 9234a2a

Please sign in to comment.