1. How exactly do I reference a table from another document in my current one? For example: Sample1.lua contains SampleTable.Section (SampleTable does not have the "local" tag) and I'm trying to access it in Sample2.lua

    What I've tried so far is: Sample1.SampleTable.Section and Sample1:SampleTable.Section

    Either version has WoW toss up an error. I've checked the book, and I can't seem to find anything explaining how to correctly reference a function or variable from another lua file.

    Thanks in advance.

  2. MyAddon.toc:

     ##Interface: 30100
     ##Title: MyAddon
     MyAddon1.lua
     MyAddon2.lua
    

    MyAddon1.lua

     MyTable = {}
     MyTable.subtable = {}
     MyTable.subtable.apple = true
    

    MyAddon2.lua

     if MyTable then print("I found MyTable") end
     if MyTable.subtable then print("I found MyTable.subtable") end
     if MyTable.subtable.apple then print("Found the apple!") end
    

    Global tables are just that.. global. you don't need to prefix them with anything. As far as Lua is concerned, there are no "files" being loaded.

  3. Okay, the tables work now, but...

    I can't get it to reference functions...

     MyAddon1.lua
     function Sample1()
     print("meow")
     end
    
     MyAddon2.lua
     function Sample2()
     Sample1()
     end
    

    That's more or less what I'm trying to do, but MyAddon2.lua treats Sample1() as variable (or at least WoW does) and displays the error: "attempted to index global 'Sample1', returned a nil value "

    I've made sure that both .lua files are in the .toc file.

  4. That's more or less what I'm trying to do, but MyAddon2.lua treats Sample1() as variable (or at least WoW does) and displays the error: "attempted to index global 'Sample1', returned a nil value "

    I've made sure that both .lua files are in the .toc file.

    Please don't post "more or less", since it always changes the semantics of what you are trying to do. The error message you are getting is that you are trying to index a nil value (as in you're using it like a table). If you were getting a call error, it would appear like "attempt to call global 'Sample1' (a nil value)". Please post your real code, and the real error message.