Reply To: LUA Scripts in Positive Feedback Loop

Home Forums General Programming LUA Scripts in Positive Feedback Loop Reply To: LUA Scripts in Positive Feedback Loop

#118873
dnaldoog
Participant
    • Topics: 4
    • Replies: 480
    • Total: 484
    • ★★

    Hi Spiffo,

    This is taken from the lua manual PIL lua.org/pil/6.html

    A somewhat difficult notion in Lua is that functions, like all other values, are anonymous; they do not have names. When we talk about a function name, say print, we are actually talking about a variable that holds that function.
    If functions are values, are there any expressions that create functions? Yes. In fact, the usual way to write a function in Lua, like

    function foo (x) return 2*x end

    is just an instance of what we call syntactic sugar; in other words, it is just a pretty way to write

    foo = function (x) return 2*x end

    … so in other words either format is fine!

    Yes you must include (mod,value,source) – It may be possible to just include function(mod) if you only use ‘mod’ in the function, or function(mod,value) but there’s no good reason for doing that that I can imagine.

    Adapting Possemo’s code, you could simply do something like:

    if source ~= 4 then return end

    at the head of each function you want to block.

    Ctrlr