Archive: NSISArray "Invalid command: ${myArray->Init}"


NSISArray "Invalid command: ${myArray->Init}"
NSISArray "Invalid command: ${myArray->Init}"

Why it occurs?


Did you declare the array using ${Array} myArray?


Of course!


Then attach your script or add more details.


Remember:
${Array} Array1

${myArray->Init} would be:
${Array1->Init}

-Stu


Error occurs when Section placed before .onInit function.
If .onInit function placed first all works fine.
Thank you

!define TEMP $R0

Var i
Var sHeaderDescr

${Array} arrHeaderDescr

Function .onInit
${arrHeaderDescr->Init}
StrCpy $i 0
LoopBegin:
ClearErrors
ReadINIStr $sHeaderDescr "$INSTDIR\${INI_FILE_NAME}" "${SECTION_HEADER_DESCR}" "$i"
IfErrors LoopEnd
IntOp $i $i + 1
${arrHeaderDescr->Shift} $sHeaderDescr
goto LoopBegin
LoopEnd:
FunctionEnd

Section "${PROJECT_NAME} $(DESC_CopyUI)" SecCopyUI
; [HEADER DESCRIPTION]
${arrHeaderDescr->Inited} HD_inited HD_not_inited
HD_inited:
StrCpy $i 0
ClearErrors
${arrHeaderDescr->ReadFirst} ${TEMP} $sHeaderDescr
LoopBegin:
IfErrors LoopDone
WriteINIStr "$INSTDIR\${INI_FILE_NAME}" "${SECTION_HEADER_DESCR}" "$i" "$sHeaderDescr"
IntOp $i $i + 1
ClearErrors
${arrHeaderDescr->ReadNext} ${TEMP} $sHeaderDescr
goto LoopBegin
LoopDone:
${arrHeaderDescr->Delete}
HD_not_inited:
SectionEnd


Well that would make sense because before using instructions associated with an array you need to initialise the array first in the script as well as on run time.

-Stu