01-27-2012, 07:02 AM
I already started working on this, so I'll explain what's gonna happen. And before you're gonna scream your old plugins aren't gonna work, don't worry they will
With the way things currently are, you need to put everything related to your plugin in a single file what I, as a C++ developer, really hate.
This new approach loads all Lua files from a directory inside the Plugins/ directory as a single plugin. This allows you to split parts of the plugin in separate files.
I have already uploaded a demonstration of these new plugins on the googlecode repository: http://code.google.com/p/mc-server/sourc...%2FNewTest
The plugin is called NewTest and has two files main.lua and tick.lua
main.lua contains the mandatory Initialize() function in which it registers a Tick hook.
tick.lua contains the Tick() function and some scoping tests to see what variables it can access.
variables declared with the local keyword are limited to the file or function they are in, variables declared without any keywords are global variables that can be accessed from within all files of the plugin.
With the way things currently are, you need to put everything related to your plugin in a single file what I, as a C++ developer, really hate.
This new approach loads all Lua files from a directory inside the Plugins/ directory as a single plugin. This allows you to split parts of the plugin in separate files.
I have already uploaded a demonstration of these new plugins on the googlecode repository: http://code.google.com/p/mc-server/sourc...%2FNewTest
The plugin is called NewTest and has two files main.lua and tick.lua
main.lua contains the mandatory Initialize() function in which it registers a Tick hook.
tick.lua contains the Tick() function and some scoping tests to see what variables it can access.
variables declared with the local keyword are limited to the file or function they are in, variables declared without any keywords are global variables that can be accessed from within all files of the plugin.