<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://neowiki.dev/w/index.php?action=history&amp;feed=atom&amp;title=Lua_Data_Access</id>
	<title>Lua Data Access - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://neowiki.dev/w/index.php?action=history&amp;feed=atom&amp;title=Lua_Data_Access"/>
	<link rel="alternate" type="text/html" href="https://neowiki.dev/w/index.php?title=Lua_Data_Access&amp;action=history"/>
	<updated>2026-04-08T00:14:10Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://neowiki.dev/w/index.php?title=Lua_Data_Access&amp;diff=134&amp;oldid=prev</id>
		<title>NeoWiki: Importing NeoWiki demo data</title>
		<link rel="alternate" type="text/html" href="https://neowiki.dev/w/index.php?title=Lua_Data_Access&amp;diff=134&amp;oldid=prev"/>
		<updated>2026-04-07T16:09:53Z</updated>

		<summary type="html">&lt;p&gt;Importing NeoWiki demo data&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This page demonstrates the &amp;lt;code&amp;gt;mw.neowiki&amp;lt;/code&amp;gt; Lua API for accessing NeoWiki structured data from templates and modules.&lt;br /&gt;
&lt;br /&gt;
The examples use [[Module:NeoWikiDemo]], a demo module included with NeoWiki.&lt;br /&gt;
&lt;br /&gt;
== Reading Property Values ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mw.neowiki.getValue()&amp;lt;/code&amp;gt; returns a single scalar value. &amp;lt;code&amp;gt;mw.neowiki.getAll()&amp;lt;/code&amp;gt; returns all values as a table.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Property !! getValue !! getAll&lt;br /&gt;
|-&lt;br /&gt;
| Founded at || {{#invoke:NeoWikiDemo|value|Founded at|page=ACME Inc}} || {{#invoke:NeoWikiDemo|values|Founded at|page=ACME Inc}}&lt;br /&gt;
|-&lt;br /&gt;
| Websites || {{#invoke:NeoWikiDemo|value|Websites|page=ACME Inc}} || {{#invoke:NeoWikiDemo|values|Websites|page=ACME Inc}}&lt;br /&gt;
|-&lt;br /&gt;
| Products (relations) || {{#invoke:NeoWikiDemo|value|Products|page=ACME Inc}} || {{#invoke:NeoWikiDemo|values|Products|page=ACME Inc}}&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Full Subject Data ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mw.neowiki.getMainSubject()&amp;lt;/code&amp;gt; returns all data for a Subject as a Lua table, enabling templates to render complete data views.&lt;br /&gt;
&lt;br /&gt;
=== Professional Wiki ===&lt;br /&gt;
&lt;br /&gt;
{{#invoke:NeoWikiDemo|subject|Professional Wiki}}&lt;br /&gt;
&lt;br /&gt;
=== ACME Inc ===&lt;br /&gt;
&lt;br /&gt;
{{#invoke:NeoWikiDemo|subject|ACME Inc}}&lt;br /&gt;
&lt;br /&gt;
== Child Subjects ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;mw.neowiki.getChildSubjects()&amp;lt;/code&amp;gt; returns all non-main Subjects on a page.&lt;br /&gt;
&lt;br /&gt;
Child subjects on [[ACME Inc]]: {{#invoke:NeoWikiDemo|children|ACME Inc}}&lt;br /&gt;
&lt;br /&gt;
== Module Source ==&lt;br /&gt;
&lt;br /&gt;
The demo module uses these &amp;lt;code&amp;gt;mw.neowiki&amp;lt;/code&amp;gt; functions:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
local nw = require( &amp;#039;mw.neowiki&amp;#039; )&lt;br /&gt;
&lt;br /&gt;
-- Read a single value (always returns a scalar or nil)&lt;br /&gt;
nw.getValue( &amp;#039;Founded at&amp;#039; )             --&amp;gt; 2005&lt;br /&gt;
nw.getValue( &amp;#039;Products&amp;#039; )               --&amp;gt; &amp;quot;Foo&amp;quot; (first value only)&lt;br /&gt;
&lt;br /&gt;
-- Read all values (always returns a 1-indexed table or nil)&lt;br /&gt;
nw.getAll( &amp;#039;Products&amp;#039; )                 --&amp;gt; { &amp;quot;Foo&amp;quot;, &amp;quot;Bar&amp;quot;, &amp;quot;Baz&amp;quot; }&lt;br /&gt;
&lt;br /&gt;
-- Get full subject data&lt;br /&gt;
local s = nw.getMainSubject( &amp;#039;ACME Inc&amp;#039; )&lt;br /&gt;
s.id, s.label, s.schema, s.statements&lt;br /&gt;
&lt;br /&gt;
-- Get child subjects&lt;br /&gt;
local children = nw.getChildSubjects( &amp;#039;ACME Inc&amp;#039; )&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See [[Module:NeoWikiDemo]] for the full source.&lt;/div&gt;</summary>
		<author><name>NeoWiki</name></author>
	</entry>
</feed>