Skip to content

Help with module logik #20173

Answered by sfromis
ChrisVonFrosta asked this question in Q&A
Dec 5, 2023 · 4 comments · 14 replies
Discussion options

You must be logged in to vote

everything from the definition of class Taster : Sensor... end

Does that mean all of classes Aktor, Licht, Sensor and Taster? Assuming yes.

You did not show where you stumbled.... Anyway, if all you want is to be able to create instances of classes, without the module as such housing data, one approach would be to let the module be a singleton only able to create class instances, like this:

var mymodule = module("mymodule")

#  your classes

mymodule.Licht = def (output_number, name) return Licht(output_number, name) end
mymodule.Taster = def (input_number, name) return Taster(input_number, name) end
return mymodule

And then code like var l_wohnz = mymodule.Licht(1, 'Name1')

As the Licht

Replies: 4 comments 14 replies

Comment options

You must be logged in to vote
4 replies
@ChrisVonFrosta
Comment options

@ChrisVonFrosta
Comment options

@sfromis
Comment options

@ChrisVonFrosta
Comment options

Comment options

You must be logged in to vote
3 replies
@sfromis
Comment options

Answer selected by ChrisVonFrosta
@ChrisVonFrosta
Comment options

@sfromis
Comment options

Comment options

You must be logged in to vote
3 replies
@sfromis
Comment options

@ChrisVonFrosta
Comment options

@sfromis
Comment options

Comment options

You must be logged in to vote
4 replies
@sfromis
Comment options

@ChrisVonFrosta
Comment options

@sfromis
Comment options

@ChrisVonFrosta
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants