Merge pull request #141 from VE-FORBRYDERNE/lua
Correct typos in bridge.lua and API documentation
This commit is contained in:
commit
4bd9ac5a66
|
@ -165,7 +165,7 @@ return function(_python, _bridged)
|
||||||
---@field num_outputs integer
|
---@field num_outputs integer
|
||||||
---@field feedback string
|
---@field feedback string
|
||||||
---@field is_config_file_open boolean
|
---@field is_config_file_open boolean
|
||||||
local kobold = setmetatable({API_VERSION = 1.1}, metawrapper)
|
local kobold = setmetatable({API_VERSION = 1.2}, metawrapper)
|
||||||
local KoboldLib_mt = setmetatable({}, metawrapper)
|
local KoboldLib_mt = setmetatable({}, metawrapper)
|
||||||
local KoboldLib_getters = setmetatable({}, metawrapper)
|
local KoboldLib_getters = setmetatable({}, metawrapper)
|
||||||
local KoboldLib_setters = setmetatable({}, metawrapper)
|
local KoboldLib_setters = setmetatable({}, metawrapper)
|
||||||
|
@ -505,6 +505,7 @@ return function(_python, _bridged)
|
||||||
elseif entries.name == "KoboldWorldInfoEntry" then
|
elseif entries.name == "KoboldWorldInfoEntry" then
|
||||||
_entries = {entries}
|
_entries = {entries}
|
||||||
else
|
else
|
||||||
|
_entries = {}
|
||||||
for k, v in pairs(entries) do
|
for k, v in pairs(entries) do
|
||||||
if type(v) == "table" and v.name == "KoboldWorldInfoEntry" and v:is_valid() then
|
if type(v) == "table" and v.name == "KoboldWorldInfoEntry" and v:is_valid() then
|
||||||
_entries[k] = v.uid
|
_entries[k] = v.uid
|
||||||
|
|
|
@ -470,11 +470,11 @@
|
||||||
<pre class=" language-lua"><code class="prism language-lua"><span class="token keyword">local</span> entry <span class="token operator">=</span> kobold<span class="token punctuation">.</span>worldinfo<span class="token punctuation">[</span><span class="token number">5</span><span class="token punctuation">]</span> <span class="token comment">-- Retrieves fifth entry from top as a KoboldWorldInfoEntry</span>
|
<pre class=" language-lua"><code class="prism language-lua"><span class="token keyword">local</span> entry <span class="token operator">=</span> kobold<span class="token punctuation">.</span>worldinfo<span class="token punctuation">[</span><span class="token number">5</span><span class="token punctuation">]</span> <span class="token comment">-- Retrieves fifth entry from top as a KoboldWorldInfoEntry</span>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>You can use <code>ipairs</code> or a numeric loop to iterate from top to bottom:</p>
|
<p>You can use <code>ipairs</code> or a numeric loop to iterate from top to bottom:</p>
|
||||||
<pre class=" language-lua"><code class="prism language-lua"><span class="token keyword">for</span> index<span class="token punctuation">,</span> entry <span class="token keyword">in</span> <span class="token function">ipairs</span><span class="token punctuation">(</span>kobold<span class="token punctuation">.</span>worldinfo<span class="token punctuation">)</span><span class="token punctuation">:</span>
|
<pre class=" language-lua"><code class="prism language-lua"><span class="token keyword">for</span> index<span class="token punctuation">,</span> entry <span class="token keyword">in</span> <span class="token function">ipairs</span><span class="token punctuation">(</span>kobold<span class="token punctuation">.</span>worldinfo<span class="token punctuation">)</span> <span class="token keyword">do</span>
|
||||||
<span class="token function">print</span><span class="token punctuation">(</span>index<span class="token punctuation">,</span> entry<span class="token punctuation">.</span>content<span class="token punctuation">)</span>
|
<span class="token function">print</span><span class="token punctuation">(</span>index<span class="token punctuation">,</span> entry<span class="token punctuation">.</span>content<span class="token punctuation">)</span>
|
||||||
<span class="token keyword">end</span>
|
<span class="token keyword">end</span>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<pre class=" language-lua"><code class="prism language-lua"><span class="token keyword">for</span> index <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token operator">#</span>kobold<span class="token punctuation">.</span>worldinfo <span class="token keyword">do</span><span class="token punctuation">:</span>
|
<pre class=" language-lua"><code class="prism language-lua"><span class="token keyword">for</span> index <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token operator">#</span>kobold<span class="token punctuation">.</span>worldinfo <span class="token keyword">do</span>
|
||||||
<span class="token function">print</span><span class="token punctuation">(</span>index<span class="token punctuation">,</span> kobold<span class="token punctuation">.</span>worldinfo<span class="token punctuation">[</span>index<span class="token punctuation">]</span><span class="token punctuation">.</span>content<span class="token punctuation">)</span>
|
<span class="token function">print</span><span class="token punctuation">(</span>index<span class="token punctuation">,</span> kobold<span class="token punctuation">.</span>worldinfo<span class="token punctuation">[</span>index<span class="token punctuation">]</span><span class="token punctuation">.</span>content<span class="token punctuation">)</span>
|
||||||
<span class="token keyword">end</span>
|
<span class="token keyword">end</span>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
@ -531,11 +531,11 @@
|
||||||
<p>Can be indexed in amortized constant worst-case time and iterated over and has a <code>finduid</code> method just like <code>kobold.worldinfo</code>, but gets folders (as <code>KoboldWorldInfoFolder</code> objects) instead.</p>
|
<p>Can be indexed in amortized constant worst-case time and iterated over and has a <code>finduid</code> method just like <code>kobold.worldinfo</code>, but gets folders (as <code>KoboldWorldInfoFolder</code> objects) instead.</p>
|
||||||
<pre class=" language-lua"><code class="prism language-lua"><span class="token keyword">local</span> folder <span class="token operator">=</span> kobold<span class="token punctuation">.</span>worldinfo<span class="token punctuation">.</span>folders<span class="token punctuation">[</span><span class="token number">5</span><span class="token punctuation">]</span> <span class="token comment">-- Retrieves fifth folder from top as a KoboldWorldInfoFolder</span>
|
<pre class=" language-lua"><code class="prism language-lua"><span class="token keyword">local</span> folder <span class="token operator">=</span> kobold<span class="token punctuation">.</span>worldinfo<span class="token punctuation">.</span>folders<span class="token punctuation">[</span><span class="token number">5</span><span class="token punctuation">]</span> <span class="token comment">-- Retrieves fifth folder from top as a KoboldWorldInfoFolder</span>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<pre class=" language-lua"><code class="prism language-lua"><span class="token keyword">for</span> index<span class="token punctuation">,</span> folder <span class="token keyword">in</span> <span class="token function">ipairs</span><span class="token punctuation">(</span>kobold<span class="token punctuation">.</span>worldinfo<span class="token punctuation">.</span>folders<span class="token punctuation">)</span><span class="token punctuation">:</span>
|
<pre class=" language-lua"><code class="prism language-lua"><span class="token keyword">for</span> index<span class="token punctuation">,</span> folder <span class="token keyword">in</span> <span class="token function">ipairs</span><span class="token punctuation">(</span>kobold<span class="token punctuation">.</span>worldinfo<span class="token punctuation">.</span>folders<span class="token punctuation">)</span> <span class="token keyword">do</span>
|
||||||
<span class="token function">print</span><span class="token punctuation">(</span>index<span class="token punctuation">,</span> folder<span class="token punctuation">.</span>name<span class="token punctuation">)</span>
|
<span class="token function">print</span><span class="token punctuation">(</span>index<span class="token punctuation">,</span> folder<span class="token punctuation">.</span>name<span class="token punctuation">)</span>
|
||||||
<span class="token keyword">end</span>
|
<span class="token keyword">end</span>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<pre class=" language-lua"><code class="prism language-lua"><span class="token keyword">for</span> index <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token operator">#</span>kobold<span class="token punctuation">.</span>worldinfo<span class="token punctuation">.</span>folders <span class="token keyword">do</span><span class="token punctuation">:</span>
|
<pre class=" language-lua"><code class="prism language-lua"><span class="token keyword">for</span> index <span class="token operator">=</span> <span class="token number">1</span><span class="token punctuation">,</span> <span class="token operator">#</span>kobold<span class="token punctuation">.</span>worldinfo<span class="token punctuation">.</span>folders <span class="token keyword">do</span>
|
||||||
<span class="token function">print</span><span class="token punctuation">(</span>index<span class="token punctuation">,</span> kobold<span class="token punctuation">.</span>worldinfo<span class="token punctuation">.</span>folders<span class="token punctuation">[</span>index<span class="token punctuation">]</span><span class="token punctuation">.</span>name<span class="token punctuation">)</span>
|
<span class="token function">print</span><span class="token punctuation">(</span>index<span class="token punctuation">,</span> kobold<span class="token punctuation">.</span>worldinfo<span class="token punctuation">.</span>folders<span class="token punctuation">[</span>index<span class="token punctuation">]</span><span class="token punctuation">.</span>name<span class="token punctuation">)</span>
|
||||||
<span class="token keyword">end</span>
|
<span class="token keyword">end</span>
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
|
@ -503,13 +503,13 @@ local entry = kobold.worldinfo[5] -- Retrieves fifth entry from top as a Kobold
|
||||||
You can use `ipairs` or a numeric loop to iterate from top to bottom:
|
You can use `ipairs` or a numeric loop to iterate from top to bottom:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
for index, entry in ipairs(kobold.worldinfo):
|
for index, entry in ipairs(kobold.worldinfo) do
|
||||||
print(index, entry.content)
|
print(index, entry.content)
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
for index = 1, #kobold.worldinfo do:
|
for index = 1, #kobold.worldinfo do
|
||||||
print(index, kobold.worldinfo[index].content)
|
print(index, kobold.worldinfo[index].content)
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
@ -587,13 +587,13 @@ local folder = kobold.worldinfo.folders[5] -- Retrieves fifth folder from top a
|
||||||
```
|
```
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
for index, folder in ipairs(kobold.worldinfo.folders):
|
for index, folder in ipairs(kobold.worldinfo.folders) do
|
||||||
print(index, folder.name)
|
print(index, folder.name)
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
for index = 1, #kobold.worldinfo.folders do:
|
for index = 1, #kobold.worldinfo.folders do
|
||||||
print(index, kobold.worldinfo.folders[index].name)
|
print(index, kobold.worldinfo.folders[index].name)
|
||||||
end
|
end
|
||||||
```
|
```
|
||||||
|
|
Loading…
Reference in New Issue