Call a ComponentLua

  • As far as I can tell all Plugin components are loaded into the same name space. provided the function is not local you can just call it from the any other plugin. I suspect there might be a better way to do this but looking at the built in plugins this is how they do it.


    So if you have two LUA files loaded into your XML:

    file1.lua

    file2.lua


    And in file2.lua you have the following function:

    Code
    1. function fromFile2()
    2. Echo("This if from file 2")
    3. end

    and the following in file1.lua:


    Code
    1. Echo("This is from file 1") -- prints this is from file 1
    2. fromFile2() -- prints this is from file 2

    also looking at the hardware test plugins you probably want to make the global functions Globally unique by making your own "namespace" so you don't end up with Collisions. For example:


    Code
    1. function MYPLUGIN:fromFile2()
    2. Echo("This if from file 2")
    3. end



    Code
    1. Echo("This is from file 1") -- prints this is from file 1
    2. MYPLUGIN:fromFile2() -- prints this is from file 2