<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://onto-wiki.eu/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ALustache%2FContext</id>
	<title>Module:Lustache/Context - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://onto-wiki.eu/w/index.php?action=history&amp;feed=atom&amp;title=Module%3ALustache%2FContext"/>
	<link rel="alternate" type="text/html" href="https://onto-wiki.eu/w/index.php?title=Module:Lustache/Context&amp;action=history"/>
	<updated>2026-05-01T03:02:38Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.3</generator>
	<entry>
		<id>https://onto-wiki.eu/w/index.php?title=Module:Lustache/Context&amp;diff=21&amp;oldid=prev</id>
		<title>Maintenance script: Install package: OSW Core</title>
		<link rel="alternate" type="text/html" href="https://onto-wiki.eu/w/index.php?title=Module:Lustache/Context&amp;diff=21&amp;oldid=prev"/>
		<updated>2023-03-25T05:55:06Z</updated>

		<summary type="html">&lt;p&gt;Install package: OSW Core&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;local string_find, string_split, tostring, type =&lt;br /&gt;
      string.find, string.split, tostring, type&lt;br /&gt;
&lt;br /&gt;
local context = {}&lt;br /&gt;
context.__index = context&lt;br /&gt;
&lt;br /&gt;
function context:clear_cache()&lt;br /&gt;
  self.cache = {}&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function context:push(view)&lt;br /&gt;
  return self:new(view, self)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function context:lookup(name)&lt;br /&gt;
  local value = self.cache[name]&lt;br /&gt;
&lt;br /&gt;
  if not value then&lt;br /&gt;
    if name == &amp;quot;.&amp;quot; then&lt;br /&gt;
      value = self.view&lt;br /&gt;
    else&lt;br /&gt;
      local context = self&lt;br /&gt;
&lt;br /&gt;
      while context do&lt;br /&gt;
        if string_find(name, &amp;quot;.&amp;quot;) &amp;gt; 0 then&lt;br /&gt;
          local names = string_split(name, &amp;quot;.&amp;quot;)&lt;br /&gt;
          local i = 0&lt;br /&gt;
&lt;br /&gt;
          value = context.view&lt;br /&gt;
&lt;br /&gt;
          if(type(value)) == &amp;quot;number&amp;quot; then&lt;br /&gt;
            value = tostring(value)&lt;br /&gt;
          end&lt;br /&gt;
&lt;br /&gt;
          while value and i &amp;lt; #names do&lt;br /&gt;
            i = i + 1&lt;br /&gt;
            value = value[names[i]]&lt;br /&gt;
          end&lt;br /&gt;
        else&lt;br /&gt;
          value = context.view[name]&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        if value then&lt;br /&gt;
          break&lt;br /&gt;
        end&lt;br /&gt;
&lt;br /&gt;
        context = context.parent&lt;br /&gt;
      end&lt;br /&gt;
    end&lt;br /&gt;
&lt;br /&gt;
    self.cache[name] = value&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  return value&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
function context:new(view, parent)&lt;br /&gt;
  local out = {&lt;br /&gt;
    view   = view,&lt;br /&gt;
    parent = parent,&lt;br /&gt;
    cache  = {},&lt;br /&gt;
  }&lt;br /&gt;
  return setmetatable(out, context)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return context&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>