Replacing values stored in table from/to a certain position #227
-
Hi, Ctrlr receives midi messages, they are filtered by type beforehand. The different text on the screen are not updated as a whole. Instead to optimise bandwith, only the text to be updated is sent with a byte-flag from the message telling the positon from where to update the text.
In my script I set a table to store the different characters and only the new characters should be replaced in the table. Here is my script :
I have another problem, I can't figure how to get the text stored as characters instead of numbers.
I tried so many things, first I tried only with setting the incoming text to the label then change the text with string.sub but I can't find how to set the update start position, and the new text to replace with. I probably turn something very easy to very difficult and combersome. That would be really nice if you could help me with that ;) thanks Damien |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
Why not using a memory block to store your texts?
|
Beta Was this translation helpful? Give feedback.
-
Hi,
If you could check what I have in my following script that would save me, I spent the whole afternoon to check the Lua docs but it did not helped that much. I just want to replace a portion of text in a label after all, it shouldn't be that hard. But I'm stuck, I don't get it.
I commented the table.concat at the bottom because sometimes it crashes (nil) value Thanks a lot in advance ;) Damien |
Beta Was this translation helpful? Give feedback.
-
Remind me to use m:toString() or even m:getRange(start,numBytes):toString next time rather than the function I posted! Thanks! Always forget that one. Here is a potential strategy/solution:
buffer 112 save state_1_2_save state_2021-03-28_17-20.zip change log 3/28 substituted |
Beta Was this translation helpful? Give feedback.
Remind me to use m:toString() or even m:getRange(start,numBytes):toString next time rather than the function I posted! Thanks! Always forget that one.
Here is a potential strategy/solution: