tag:github.com,2008:https://github.com/WeaselGames/godot_luaAPI/releasesRelease notes from godot_luaAPI2024-01-24T18:48:08Ztag:github.com,2008:Repository/351998623/v2.1-beta112024-01-24T20:29:06Zv2.1-beta11<p><g-emoji class="g-emoji" alias="warning">⚠️</g-emoji> <strong>This release of LuaAPI is for godot version</strong> <code>4.2.x</code></p>
<h2>What's Changed</h2>
<ul>
<li><em><strong>BREAKING</strong></em>: <code>LuaAPI.do_file</code> and <code>LuaAPI.do_string</code> both had their return types changed from <code>LuaError</code> to <code>Variant</code>. This is to allow for return values.</li>
<li><code>LuaAPI.do_file</code> and <code>LuaAPI.do_string</code> both now take an optimal second argument. Which would be an Array of arguments to pass to the script.</li>
<li>Some minor documentation changes</li>
</ul>
<p>Example usage:</p>
<div class="highlight highlight-source-gdscript notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="func _ready():
var lua: LuaAPI = LuaAPI.new()
lua.bind_libraries(["base", "table", "string"])
var ret = lua.do_string("""
local a, b = ...
print(a, b)
return a + b
""", [4, 6])
if ret is LuaError:
print("ERROR %d: %s" % [ret.type, ret.message])
return
print(ret)
"><pre><span class="pl-k">func</span> <span class="pl-en">_ready</span>():
<span class="pl-k">var</span> <span class="pl-smi">lua</span>: <span class="pl-en">LuaAPI</span> <span class="pl-k">=</span> <span class="pl-en">LuaAPI</span>.<span class="pl-en">new</span>()
<span class="pl-smi">lua</span>.<span class="pl-en">bind_libraries</span>([<span class="pl-s">"base"</span>, <span class="pl-s">"table"</span>, <span class="pl-s">"string"</span>])
<span class="pl-k">var</span> <span class="pl-smi">ret</span> <span class="pl-k">=</span> <span class="pl-smi">lua</span>.<span class="pl-en">do_string</span>(<span class="pl-s">"""</span>
<span class="pl-s"> local a, b = ...</span>
<span class="pl-s"> print(a, b)</span>
<span class="pl-s"> return a + b</span>
<span class="pl-s"> """</span>, [<span class="pl-c1">4</span>, <span class="pl-c1">6</span>])
<span class="pl-k">if</span> <span class="pl-smi">ret</span> <span class="pl-k">is</span> <span class="pl-en">LuaError</span>:
<span class="pl-en">print</span>(<span class="pl-s">"ERROR <span class="pl-c1">%d</span>: <span class="pl-c1">%s</span>"</span> <span class="pl-k">%</span> [<span class="pl-smi">ret</span>.<span class="pl-smi">type</span>, <span class="pl-smi">ret</span>.<span class="pl-smi">message</span>])
<span class="pl-k">return</span>
<span class="pl-en">print</span>(<span class="pl-smi">ret</span>)
</pre></div>
<p>Module MacOS actions started failing randomly so are sadly not included in this release.</p>Trey2ktag:github.com,2008:Repository/351998623/v2.1-beta102024-01-04T05:20:11Zv2.1-beta10<p><g-emoji class="g-emoji" alias="warning">⚠️</g-emoji> <strong>This release of LuaAPI is for godot version</strong> <code>4.2.x</code></p>
<h2>What's Changed</h2>
<ul>
<li>Minor in-engine documentation corrections by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/sepTN/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/sepTN">@sepTN</a></li>
<li>Module builds updated to 4.2.1</li>
</ul>Trey2ktag:github.com,2008:Repository/351998623/v2.1-beta92023-12-01T03:31:20Zv2.1-beta9<p><g-emoji class="g-emoji" alias="warning">⚠️</g-emoji> <strong>This release of LuaAPI is for godot version</strong> <code>4.2.x</code></p>
<h2>What's Changed</h2>
<ul>
<li>Memory leak described in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1888034099" data-permission-text="Title is private" data-url="https://github.com/WeaselGames/godot_luaAPI/issues/155" data-hovercard-type="issue" data-hovercard-url="/WeaselGames/godot_luaAPI/issues/155/hovercard" href="https://github.com/WeaselGames/godot_luaAPI/issues/155">#155</a> has been resolved now that GDExtension supports CallableCustoms. (Thanks to the amazing work done by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/dsnopek/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/dsnopek">@dsnopek</a> and other contributors in the <a href="https://github.com/godotengine/godot/pull/79005" data-hovercard-type="pull_request" data-hovercard-url="/godotengine/godot/pull/79005/hovercard">Godot Engine</a> and <a href="https://github.com/godotengine/godot-cpp/pull/1155" data-hovercard-type="pull_request" data-hovercard-url="/godotengine/godot-cpp/pull/1155/hovercard">godot-cpp</a>.)</li>
<li><em><strong>BREAKING</strong></em>: Lua methods pulled as a Callable no longer take an array of arguments, arguments are passed 1 by 1 now. So instead of <code>myLuaFunc.call([arg1, arg2])</code> it is <code>myLuaFun.call(arg1, arg2)</code>.</li>
</ul>
<p>A special thanks to <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/Tekuzo/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/Tekuzo">@Tekuzo</a> as well, who helped upload the releases due to my internet being too slow currently.</p>Trey2ktag:github.com,2008:Repository/351998623/v2.1-beta82023-10-13T23:33:55Zv2.1-beta8<p><g-emoji class="g-emoji" alias="warning">⚠️</g-emoji> <strong>This release of LuaAPI is for godot version</strong> <code>4.1.x</code></p>
<h2>What's Changed</h2>
<ul>
<li>Small bug fix for crashes related to when Lua loses reference of a RefCounted before godot.</li>
</ul>Trey2ktag:github.com,2008:Repository/351998623/v2.1-beta72023-10-11T16:45:18Zv2.1-beta7<p><g-emoji class="g-emoji" alias="warning">⚠️</g-emoji> <strong>This release of LuaAPI is for godot version</strong> <code>4.1.x</code></p>
<h2>What's Changed</h2>
<ul>
<li>New LuaAPI field <code>LuaAPI.use_callables</code> when true, it will use the <code>LuaCallable</code> type which is a <code>CallableCustom</code> for lua methods like before. When false it will instead use the <code>LuaFunctionRef</code> type which is a <code>RefCounted</code>. It behaves the same but will use a <code>invoke</code> method rather then <code>call</code>. This resolves the issue of C# not supporting <code>CallableCustom</code> types. More details in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1933708390" data-permission-text="Title is private" data-url="https://github.com/WeaselGames/godot_luaAPI/issues/172" data-hovercard-type="pull_request" data-hovercard-url="/WeaselGames/godot_luaAPI/pull/172/hovercard" href="https://github.com/WeaselGames/godot_luaAPI/pull/172">#172</a></li>
<li>Module releases are now using Godot v4.1.2-stable</li>
<li>Memory leak described in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1888034099" data-permission-text="Title is private" data-url="https://github.com/WeaselGames/godot_luaAPI/issues/155" data-hovercard-type="issue" data-hovercard-url="/WeaselGames/godot_luaAPI/issues/155/hovercard" href="https://github.com/WeaselGames/godot_luaAPI/issues/155">#155</a> has been fixed for all module builds. And a work around now exists for GDExtension using <code>LuaFunctionRefs</code></li>
</ul>Trey2ktag:github.com,2008:Repository/351998623/v2.1-beta62023-10-05T15:52:59Zv2.1-beta6<p><g-emoji class="g-emoji" alias="warning">⚠️</g-emoji> <strong>This release of LuaAPI is for godot version</strong> <code>4.1.x</code></p>
<h2>What's Changed</h2>
<ul>
<li>Added support for UTF8 strings</li>
<li>Added support for the FFI library while using the luaJIT builds.</li>
</ul>Trey2ktag:github.com,2008:Repository/351998623/v1.2-beta12023-10-02T01:57:21Zv1.2-beta1<p><g-emoji class="g-emoji" alias="warning">⚠️</g-emoji> <strong>This release of LuaAPI is for godot version</strong> <code>3.x</code></p>
<h2>What's Changed</h2>
<ul>
<li>Added support for UTF8 strings</li>
</ul>Trey2ktag:github.com,2008:Repository/351998623/v2.1-beta52023-10-02T04:15:40Zv2.1-beta5<p><g-emoji class="g-emoji" alias="warning">⚠️</g-emoji> <strong>This release of LuaAPI is for godot version</strong> <code>4.1.x</code></p>
<h2>What's Changed</h2>
<ul>
<li>New methods to access and modify registry values from @RadiantUwU</li>
<li>Some demo bug fixes from <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/SilicDev/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/SilicDev">@SilicDev</a></li>
</ul>Trey2ktag:github.com,2008:Repository/351998623/v2.1-beta42023-07-20T12:11:43Zv2.1-beta4<p><g-emoji class="g-emoji" alias="warning">⚠️</g-emoji> <strong>This release of LuaAPI is for godot version</strong> <code>4.1.x</code></p>
<h2>What's Changed</h2>
<ul>
<li>Fixed some return types to allow for mono glue generation.</li>
<li>The LuaAPI class memory usage, and limit are now uint64's rather then just a signed int32.</li>
<li><code>__index</code> and <code>__newindex</code> now do not force the String type as the index, as this could in theory be any type.</li>
</ul>Trey2ktag:github.com,2008:Repository/351998623/v2.1-beta32023-07-13T16:38:14Zv2.1-beta3<p><g-emoji class="g-emoji" alias="warning">⚠️</g-emoji> <strong>This release of LuaAPI is for godot version</strong> <code>4.1.x</code></p>
<p>This is the first large feature update for LuaAPI v2.1</p>
<h2>What's Changed</h2>
<ul>
<li>Added <code>memory_limit</code> property to the <strong>LuaAPI</strong> class. This allows to set the max allowed memory usage for the Lua state in bytes.</li>
<li>Added <code>object_metatable</code> property to the <strong>LuaAPI</strong> class. This sets the default metatable for Objects which do not define a <code>lua_metatable</code> property.</li>
<li>Removed <code>permissive</code> property from the <strong>LuaAPI</strong> class. This has been replaced with the <code>permissive</code> property on <strong>LuaDefaultObjectMetatable</strong> which occupies the <strong>LuaAPI</strong> <code>object_metatable</code> property by default.</li>
<li>Added <code>get_memory_usage()</code> method to the <strong>LuaAPI</strong> class. This returns the current memory usage of the Lua state in bytes.</li>
<li>Removed <code>expose_object_constructor()</code> from the <strong>LuaAPI</strong> class. This is no longer needed, you can push the obj.new method as a global using <code>LuaAPI.push_global()</code> for the same effect but with constructor argument support.</li>
<li>New <strong>LuaObjectMetatable</strong> class. This is a interface class meant to be used to define metatables.</li>
<li>New <strong>LuaDefaultObjectMetatable</strong> class. This is the type that <code>object_metatable</code> defaults to, it provides the same functionality with metatables and metamethods we had before this update. The <strong>LuaAPI</strong> permissive property has been moved to this class now. It will yield metamethod calls to the object if it defines them like before. Otherwise looks for the <code>lua_fields</code> method which is either a blacklist or a whitelist depending on <code>permissive</code>.</li>
</ul>
<p>There are a lot of changes with this update so I suspect there may be some regression, if you notice any please open an <a href="https://github.com/WeaselGames/godot_luaAPI/issues/new/choose">issue</a>.</p>Trey2k