Studying Lua functions. Could use a little help.

BECOME PART OF THE COMMUNITY - Sign up here
  • I'm following the Lua for grand ma2 course by "aguynamedjonas" on ma3. Because the tuts are made for ma2 I have to use ma3 commands instead of ma2 commands and most of the time I get it to work. I do however have a question on the following.

    In the tutorial about functions we are trying to make a very simple plugin that has one function that selects a exec and an other function that calls the function that selects the exec. The first function that selects the exec is giving the problems.

    The ma3 system monitor is giving the following error: LUA: no reference to main function found for pluging (name of plugin)

    This is the function:

      pageNo = 2
      executorNo = 203

    function selectExec(pageNo, executorNo)

      Cmd("select page "..pageNo.." executor "..executorNo..)
    end

    return selectExec



    Can you please explain what i'm doing wrong?

  • in your code i see 2 error for my knowlegde in the end of ..executorNo you dont have to put the '..' anche in the function you don't need to declare the pageNo and ExecutorNo, the code i put here it's tested and working

  • Ah, yes. The two dots where the problem. Thank you so much! :)

    Can you explain what reasoning is? Why do you need to add two dots at the beginning and the end when a variable is in the middle of a command and only two dots at the beginning of the variable when it is placed at the end of the command?

  • the .. are concatenate for the LUA var, as far as I know, (I could be wrong)

    You can use the ".." to concatenate VAR, but it will give an error if you use it and there is nothing to concatenate.
    You can have a Concatenate for the begin and for the end,
    Some example how you can use it :
    Cmd("select page "..pageNo.." executor "..executorNo.."") If you want to put after "executorNo" you can but you need to concatenate with something, in the example ""

    Cmd("FaderMaster Page " ..pageNo.."."..executorNo.." at 100 fade 3")

    All the time that you need to concatenate a Var with String (in this case with CMD Function) you need to use the ..

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!