Changeset

12479:4d36fbcdd210 0.12

core.moduleapi: Fix 'global' property via :context() - #1748 The 'global' property should reflect whether the module API instance represents the global context or a VirtualHost or Component context. However the module:context() method did not override this, leading the property of the previous module shining trough, leading to bugs in code relying on the 'global' property. See also #1736
author Kim Alvefur <zash@zash.se>
date Wed, 27 Apr 2022 17:18:46 +0200
parents 12477:cc84682b8429
children 12485:794f5ec0f347 12488:3183f358a88f
files core/moduleapi.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/core/moduleapi.lua	Mon Apr 25 15:24:56 2022 +0100
+++ b/core/moduleapi.lua	Wed Apr 27 17:18:46 2022 +0200
@@ -307,7 +307,7 @@
 
 
 function api:context(host)
-	return setmetatable({host=host or "*"}, {__index=self,__newindex=self});
+	return setmetatable({ host = host or "*", global = "*" == host }, { __index = self, __newindex = self });
 end
 
 function api:add_item(key, value)