class "SnippetAlias"(rd.DocumentNode)
function SnippetAlias:__init()
rd.DocumentNode.__init(self)
self:add_property("parameter_list", rd.ObservableStringList())
end
I get the following error:
std::logic_error: 'invalid, unexpected type for add_property. expected an ObservableBoolean/Number/String object'
stack traceback:
[C]: in function 'add_property'
.\prefs.lua:202: in function <.><br>
[C]: in function 'SnippetAlias'<br>
.\prefs.lua:37: in function 'init'<br>
main.lua:15: in main chunk<br>```
<br>
<br>
On the other hand, this seems to work:<br>
<br>
```<br><br>
class "SnippetAlias"(rd.DocumentNode)<br>
function SnippetAlias:__init()<br>
rd.DocumentNode.__init(self)<br>
self:add_property("parameter_list", { "qwer" })<br>
self.parameter_list:remove(1)<br>
end<br>```
<br>
<br>
I want an empty StringList to work with, the last snippet runs but it's not nice. Am I missing something?</.>
class "SnippetAlias"(rd.DocumentNode)
function SnippetAlias:__init()
rd.DocumentNode.__init(self)
self:add_property("parameter_list", rd.ObservableStringList())
end
I get the following error:
std::logic_error: 'invalid, unexpected type for add_property. expected an ObservableBoolean/Number/String object'
stack traceback:
[C]: in function 'add_property'
.\prefs.lua:202: in function <.><br>
[C]: in function 'SnippetAlias'<br>
.\prefs.lua:37: in function 'init'<br>
main.lua:15: in main chunk<br>```
<br>
<br>
On the other hand, this seems to work:<br>
<br>
```<br><br>
class "SnippetAlias"(rd.DocumentNode)<br>
function SnippetAlias:__init()<br>
rd.DocumentNode.__init(self)<br>
self:add_property("parameter_list", { "qwer" })<br>
self.parameter_list:remove(1)<br>
end<br>```
<br>
<br>
I want an empty StringList to work with, the last snippet runs but it's not nice. Am I missing something?<br>[/quote]<br>
If you attempt to submit some sort of array, it is pretty clear the property-function doesn't support this.<br>
You either have to pick one string from rd.ObservableStringList() and send it to the property. <br>
Do an iterative process with upcounter to add them all.<br>
<br>
I'm just doing something out of the back of my head here, i doubt the below snippet works directly out of the box (since i can't tell what rd.ObservableStringList() actually returns and in what way), but you hopefully get the idea of the direction i'm trying to point you to:<br>
<br>
```<br><br>
for i = 1, #rd.ObservableStringList() do<br>
local fetched_list_item = rd.ObservableStringList(i)<br>
self:add_property("parameter_list", { fetched_list_item })<br>
end<br>
<br>```
</.>