Search code examples
brightscript

Brightscript plugin: How to access user variables in processEvent


I'm following allong the example of the "plugins and parsers" pdf
(found here: using plugins and parsers technote (PDF) )

How do i access user variables (read, write) in the processEvent function?

Function pizza_ProcessEvent(event As Object)
  if type(event) = "roAssociativeArray" then
    if type(event["EventType"]) = "roString" then
      if event["EventType"] = "SEND_PLUGIN_MESSAGE" then
        if event["PluginName"] = "Pizza" then
          pluginMessage$ = event["PluginMessage"]
          print "received pluginMessage ";pluginMessage$
          return true
        endif
      endif
    endif 
  endif
  return false
End Function

Solution

  • They should be in m, which is the BrS equivalent of self/this.

    I.e. when for a PizzaBuilder's instance pb the method (or event; "member function" really) pb.processEvent() is called, inside it a magic variable m points to pb. So what you asked for - based on PDF sample - is probably m.userVariables.

    Disclaimer: i know Roku's B/S, not BrightSign; they are closely related.