We have detected that cookies are not enabled on your browser. Please enable cookies to ensure the proper experience.
Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2011
    Location
    Hungary
    Posts
    66

    Angry __init__.lua never processing!

    I just getting crazy. I made my __init__.lua file under my plugin folder, but look like it is never processed. I put inside variables, import, at last a single line with Turbine.Shell.WriteLine("blabl a") but it is never run.
    At last I just copy one from an other plugin, maybe I made mistake with file name or whatever see any error message but nothing. Just simple big nothing. Ok, I put the Turbine.Shell.WriteLine(messag e) into an other plugin __init__.lua file, and I saw the message when I load the other plugin, so the __init__.lua file is runnung with the other plugin. Then I copy that file under my plugin folder and there is no message. My plugin folder is cursed or what?

    Anybody have any idea what the hell happening? There is any pre-anything that I need to use this file?

  2. #2
    Okay, took a quick look at this (so I might be wrong), but it appears that __init__.lua files are only read on imports.

    So, for example, take the Eval plugin (because that's what I actually tested this on.) If I add an __init__.lua file to moebius92/Eval, with Turbine.Shell.WriteLine("Test" ); in it, when I load the plugin, nothing will be printed out. However, if I do that, and then add the line import "moebius92.Eval"; to moebius92/Eval/Main.lua, then "Test" will be printed out when I load the plugin.

    So, yeah. You need to have the plugin import itself.

  3. #3
    Join Date
    Jun 2011
    Location
    Hungary
    Posts
    66
    Aham, so that file is not imported automaticly. I just try to use Garan's guide, but look like turbine changed the lua since that.
    Before processing any files in a folder, the Lua system will look for a __init__.lua file and if one is found it will be processed first.
    So this is not correct anymore. Sad.

  4. #4
    Join Date
    Mar 2007
    Posts
    1,439
    Quote Originally Posted by bunny.hu View Post
    Aham, so that file is not imported automaticly. I just try to use Garan's guide, but look like turbine changed the lua since that.

    So this is not correct anymore. Sad.
    I believe the __init__.lua file always required an import "authorfolder.pluginfolder " line to get processed so the __init__.lua file was not imported automatically.

    I have fixed the lua for noobs posts. Sorry for the confusion.
    Last edited by Garan; Jan 18 2015 at 12:57 PM.

  5. #5
    Join Date
    Jun 2011
    Location
    Hungary
    Posts
    66
    Quote Originally Posted by Garan View Post
    I have fixed the lua for noobs posts. Sorry for the confusion.
    Thank you, you are our Hero

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

This form's session has expired. You need to reload the page.

Reload