View Issue Details

IDProjectCategoryView StatusLast Update
0003160Multi Theft Auto : San AndreasGeneralpublic2012-02-07 10:27
ReporterChrML Assigned Tokevuwk  
Status resolvedResolutionfixed 
Target Version1.3.1Fixed in Version1.3.1 
Summary0003160: Add a way to load and unload modules without restarting the server

You might not want to restart it to load new modules or update a module. The server should be fully maintainable without restarting.

TagsNo tags attached.


child of 0003344 closed New Feature Requests Requested features tracker 



2008-02-13 16:20

administrator   ~~0007255

added loadModule ( module name ) gave it a quick test and it seems fine, will look at reloadModule and unloadModule when I get time


2008-02-14 14:29

administrator   ~~0007258

Not sure it's a good idea to have as lua scripts. It's a potential security risk, ie someone could download a script containing a dll file or even camuflaged as .lua and load it as a dll and thus virus/trojan infect the server.

I think module loading/unloading should be a command only.


2008-02-15 03:10

administrator   ~~0007264

can easily be changed although we may have a problem when unloading the modules due to the functions that are registered within it, will see what happens when i get to that


2008-02-23 03:43

administrator   ~~0007309

changed loadmodule to a console command


2008-02-24 11:16

administrator   ~~0007314

Good point at #7264. The modules will have to unregister their functions explicitly. Like:

lua_pushnil ( vm );
lua_setglobal ( vm, "myRegisteredFunction" );

This will require an additional callback by MTA for every virtual machine, like RegisterFunctions. Maybe like UnregisterFunctions?


2008-02-24 11:17

administrator   ~~0007315

Last edited: 2008-02-24 11:18

Failure to unregister will cause crash next time LUA calls that registered function. When trying to call the unloaded DLL code.

Maybe we should provide a simple interface for registering functions and do this for the module? Or write an opensource function registering interface automatically doing this on unload in the module without requiring the additional callback.

But then again, the modules don't know when lua vm's are destroyed, so we'll need a callback for that.


2008-02-24 11:25

administrator   ~~0007316

another way would be to change the register functions for the module so it tells the server which module it came from, then we don't rely on the module creator to do this, eliminating the potential for crashes from a poorly made module


2008-02-27 07:43

administrator   ~~0007323

might need to add some stuff to the way the ACL adds'removed functions aswell.. if i recall i wrote a hook into lua itself for this, but not sure how ud go about removing funcs.. not looked at it in a while :P


2012-02-06 07:30

viewer   ~~0015950


Issue History

Date Modified Username Field Change