משתמש:Erel Segal/ארגז חול/יחידה:שלום

מתוך ויקיטקסט, מאגר הטקסטים החופשי
קפיצה לניווט קפיצה לחיפוש

m = {} -- you can use any name you want - it does not have to be identical to the module name

function m.f1(frame)

       return "שלום לכולם"

end

-- these two ways to define the function are practically synonymous. the 2nd form below is more common. m.f2 = function(frame)

       return "להתראות"

end

-- this function cannot be called using #invoke, because it's not a member of m. it can be called from other functions in the module. function f3(x)

       return x * 2

end

-- however, we can expose a faunction, say, f4, by defining it first, and then adding it to m like so: function something(frame)

       -- do something

end

m.f4 = something

m["להתראות"] = m.f2

m["הורים"] = function(frame)

       return frame:getParent()

end

return m