Is it possible, without a conversion table of some sort in an array, to pass a name of structure to be created
what I mean is it possible to accomplish something of the sort a$ = "something" : struct a$, x as etc, etc by 'simple' means
function to create structure with passed name
-
- Posts: 4
- Joined: Fri Mar 28, 2025 1:57 pm
Re: function to create structure with passed name
I don't know of any 'simple' way. Creating a variable with a name determined at run time is relatively easy, but the same isn't true of a structure.Adamkonrad wrote: ↑Mon Jun 23, 2025 3:45 pm Is it possible, without a conversion table of some sort in an array, to pass a name of structure to be created
what I mean is it possible to accomplish something of the sort a$ = "something" : struct a$, x as etc, etc by 'simple' means
What's the use case? Why do you want to do this?
LBB supports arrays of structures, is there any way this capability could be leveraged to do what you want?
-
- Posts: 4
- Joined: Fri Mar 28, 2025 1:57 pm
Re: function to create structure with passed name
I'm
just experimenting and exploring possibilities
I noticed in bbc basic manual,
that you can use once defined structure as a prototype for new structures, and hoped that something similar might work in LBB,
moreover perhaps have something like type in some other basics, especially as you have arrays of structures in LBB, write a subroutine or function that allows creation of something similar to type
as in LBB you made it possible to pass arrays to functions, what is extremely helpful I also hoped to pass structures as in bbc basic, but don't think it's possible in LBB, but that's a digression now
information
while playing with structures and manual, I noticed that in manual you give an example of passing to function and use abbreviation s{} in prototype and then s.x in function body, in current bbc basic editor s. expands to step, and s.x to step.x so the example
might be changed for easier following
just experimenting and exploring possibilities
I noticed in bbc basic manual,
that you can use once defined structure as a prototype for new structures, and hoped that something similar might work in LBB,
moreover perhaps have something like type in some other basics, especially as you have arrays of structures in LBB, write a subroutine or function that allows creation of something similar to type
as in LBB you made it possible to pass arrays to functions, what is extremely helpful I also hoped to pass structures as in bbc basic, but don't think it's possible in LBB, but that's a digression now
information
while playing with structures and manual, I noticed that in manual you give an example of passing to function and use abbreviation s{} in prototype and then s.x in function body, in current bbc basic editor s. expands to step, and s.x to step.x so the example
might be changed for easier following