diff --git a/builtin/game/constants.lua b/builtin/game/constants.lua
index 56fca92892c22af6926975c2b615de288d663a52..50c515b24875b6fefc2abd68787b58b9fdf1a1db 100644
--- a/builtin/game/constants.lua
+++ b/builtin/game/constants.lua
@@ -19,4 +19,9 @@ core.EMERGE_FROM_DISK   = 3
 core.EMERGE_GENERATED   = 4
 
 -- constants.h
+-- Size of mapblocks in nodes
 core.MAP_BLOCKSIZE = 16
+
+-- light.h
+-- Maximum value for node 'light_source' parameter
+core.LIGHT_MAX = 14
diff --git a/builtin/game/register.lua b/builtin/game/register.lua
index 05dc5fef83da73be5243b27fc0d4f640861ecd4d..d3f6b3df89f69fb797dcf1dc989dd59cb7606dcd 100644
--- a/builtin/game/register.lua
+++ b/builtin/game/register.lua
@@ -127,6 +127,9 @@ function core.register_item(name, itemdef)
 				fixed = {-1/8, -1/2, -1/8, 1/8, 1/2, 1/8},
 			}
 		end
+		if itemdef.light_source and itemdef.light_source > core.LIGHT_MAX then
+			error("Unable to register node: 'light_source' exceeds maximum: " .. name)
+		end
 		setmetatable(itemdef, {__index = core.nodedef_default})
 		core.registered_nodes[itemdef.name] = itemdef
 	elseif itemdef.type == "craft" then
diff --git a/doc/lua_api.txt b/doc/lua_api.txt
index b6e6520b25e1191bb2c40ff24ef276d271e91473..6f69360c86f6b7e31daa93deb89693e5e86b60c9 100644
--- a/doc/lua_api.txt
+++ b/doc/lua_api.txt
@@ -3664,7 +3664,10 @@ Definition tables
         ^ Don't forget to use "leveled" type nodebox. ]]
         liquid_range = 8, -- number of flowing nodes around source (max. 8)
         drowning = 0, -- Player will take this amount of damage if no bubbles are left
-        light_source = 0, -- Amount of light emitted by node (max. 14)
+        light_source = 0, --[[
+        ^ Amount of light emitted by node.
+        ^ To set the maximum (currently 14), use the value 'minetest.LIGHT_MAX'.
+        ^ A value outside the range 0 to minetest.LIGHT_MAX causes undefined behavior.]]
         damage_per_second = 0, -- If player is inside node, this damage is caused
         node_box = {type="regular"}, -- See "Node boxes"
         connects_to = nodenames, --[[
diff --git a/src/light.h b/src/light.h
index f49be4518188cc78971c02ccb860dd862a285f99..984e6d7c28d5d59b5e182b6f3f3e71f63c084497 100644
--- a/src/light.h
+++ b/src/light.h
@@ -27,8 +27,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 */
 
 // This directly sets the range of light.
-// Actually this is not the real maximum, and this is not the
-// brightest. The brightest is LIGHT_SUN.
+// Actually this is not the real maximum, and this is not the brightest, the
+// brightest is LIGHT_SUN.
+// If changed, this constant as defined in builtin/game/constants.lua must
+// also be changed.
 #define LIGHT_MAX 14
 // Light is stored as 4 bits, thus 15 is the maximum.
 // This brightness is reserved for sunlight