Creative: Cache creative mode setting
authorparamat <mat.gregory@virginmedia.com>
Tue, 31 Jan 2017 11:41:50 +0000 (11:41 +0000)
committerparamat <mat.gregory@virginmedia.com>
Wed, 1 Feb 2017 17:51:35 +0000 (17:51 +0000)
mods/creative/init.lua

index cd9e2b494f714578ee052d98ccfff4e05ee18db1..7471e603f51af66e13e5ea57ea60707a638417e6 100644 (file)
@@ -1,7 +1,9 @@
 creative = {}
 
+local creative_mode_cache = minetest.setting_getbool("creative_mode")
+
 function creative.is_enabled_for(name)
-       return minetest.setting_getbool("creative_mode")
+       return creative_mode_cache
 end
 
 dofile(minetest.get_modpath("creative") .. "/inventory.lua")