B4R Question Array re-dim

peacemaker

Expert
Licensed User
Longtime User
Hi, All

B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'Public variables can be accessed from all modules.
    Private timers(dinputs.Channels_num) As Timer
    Private Started(dinputs.Channels_num) As ULong
    Dim State1(dinputs.Channels_num) As Byte
    Dim State2(dinputs.Channels_num) As Byte
    Dim Switches(dinputs.Channels_num) As Byte
End Sub

This code is not compiled, error is:
The size of non-primitive arrays must be a numeric literal.

How to dim and re-dim several arrays in VARIOUS MODULES, if the dimension is variable, and known in some SINGLE separate code module ? Actually, it's const depending on the Build configurations.
 

hatzisn

Expert
Licensed User
Longtime User
I do not think you can redim an array in B4R. What you can do is use GlobalStore and save a json there in a slot with a list (json list) that you add always more at it. This is only for variables though and it is also limited of course.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…