Skip to main content
September 26, 2017
Question

If I have multiple things using the same template how do I differentiate them in the template?

  • September 26, 2017
  • 2 replies
  • 3651 views

Here is my config.lua:

scripts.TestThing = {

     file = "thing.lua",

     template = "display"

}

scripts.TestThing_Interface_0 = {

     file = "thing.lua",

     template = "interface"

}

scripts.TestThing_Interface_1 = {

     file = "thing.lua",

     template = "interface"

}

In the template when I am getting the properties how do I differentiate which interface I am getting properties for?

2 replies

16-Pearl
September 26, 2017

Let me explore the question more.

If they are of the same templates that would be different?

Have you considered multiple templates say

                    base template

                              I

subtemplate1 subtemplate2 subtemplate3 (where the sub templates have something different

if they are not different then the question is what makes them different is it a property value?

Maybe I'm off base. if so can you provide more detail

September 26, 2017

They are based on the same template on the server side, they will have different property values. The differentiating property value is called InterfaceID. This question is coming from the lua script resource environment.

16-Pearl
September 27, 2017

Are you asking how to get the property value for interfaceID in Lua?

5-Regular Member
September 28, 2017

I believe you should set the identifier for each of these things on the Platform, and then make use of the identifier property of these lua tables. From the config.lua.example file:

"identifier: Register with the EMS and Platform using this identifier."

This would effectively distinguish between each of these on the Lua side of things. I hope this helps!