mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 16:15:20 +02:00
Add shutdown hook interface to Lua API
Scripts can call minetest.register_on_shutdown() to register a shutdown hook. Document that minetest.register_on_shutdown() callbacks may not be run If the server crashes, it is unlikely that callbacks registered using minetest.register_on_shutdown() will be called.
This commit is contained in:
@@ -792,6 +792,11 @@ minetest.register_craft(recipe)
|
||||
Global callback registration functions: (Call these only at load time)
|
||||
minetest.register_globalstep(func(dtime))
|
||||
^ Called every server step, usually interval of 0.05s
|
||||
minetest.register_on_shutdown(func())
|
||||
^ Called before server shutdown
|
||||
^ WARNING: If the server terminates abnormally (i.e. crashes), the registered
|
||||
callbacks WILL LIKELY NOT BE RUN. Data should be saved at
|
||||
semi-frequent intervals as well as on server shutdown.
|
||||
minetest.register_on_placenode(func(pos, newnode, placer, oldnode))
|
||||
^ Called when a node has been placed
|
||||
^ Deprecated: Use on_construct or after_place_node in node definition instead
|
||||
|
Reference in New Issue
Block a user