# NE: Updated dmScript::LuaHBuffer constructor

**URL:** <https://forum.defold.com/t/ne-updated-dmscript-luahbuffer-constructor/69931>\
**Category:** Source Code\
**Created:** [December 15, 2021, 2:36pm UTC](https://forum.defold.com/t/ne-updated-dmscript-luahbuffer-constructor/69931 "2021-12-15T14:36:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [December 15, 2021, 2:36pm UTC](https://forum.defold.com/t/ne-updated-dmscript-luahbuffer-constructor/69931/1 "2021-12-15T14:36:15Z")

</div>

A heads up for the native extension authors:  
We’ve done a small cleanup of the (old) api for the `dmScript::LuaHBuffer` and as such, some code needs to be updated:

```lua
# from 1.2.191
dmScript::LuaHBuffer luabuffer = { buffer, true }; -> dmScript::LuaHBuffer luabuffer( buffer, dmScript::OWNER_LUA );
dmScript::LuaHBuffer luabuffer = { buffer, false }; -> dmScript::LuaHBuffer luabuffer( buffer, dmScript::OWNER_C );

```

EDIT1:  
~~The new api, is already working (and released a long time ago), so once you’ve updated to it, you can continue as usual.~~  
I confused it a bit here. The _enum_ existed some time now, not the constructors.

The constructors are the new thing.

This change is coming in the next release, so now is a good time to update your extension if you use such buffers.

We are in the process of updating the extensions we maintain.  
We also have this [CI job](https://github.com/defold/test-sdk/actions/runs/1580805380) that also builds some of the more popular external extensions, in order for us to catch these things as early as possible.

EDIT2:  
My recommendation is to prepare a branch, e.g. “update-191” to have it ready for when the 191 release is out.

---

<div class="post-metadata">

**Author:** ![d954mas](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/d954mas/32/5401_2.png) [@d954mas](https://forum.defold.com/u/d954mas)\
**Post date:** [December 15, 2021, 7:58pm UTC](https://forum.defold.com/t/ne-updated-dmscript-luahbuffer-constructor/69931/2 "2021-12-15T19:58:48Z")

</div>

Try change. Should be “{” not “(”

```lua
dmScript::LuaHBuffer luabuffer( buffer, dmScript::OWNER_LUA );

```

```lua
dmScript::LuaHBuffer luabuffer{ buffer, dmScript::OWNER_LUA };

```

---

<div class="post-metadata">

**Author:** ![dapetcu21](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/dapetcu21/32/25120_2.png) [@dapetcu21](https://forum.defold.com/u/dapetcu21)\
**Post date:** [December 15, 2021, 9:12pm UTC](https://forum.defold.com/t/ne-updated-dmscript-luahbuffer-constructor/69931/3 "2021-12-15T21:12:04Z")

</div>

Oh right! It’s not a constructor. It’s a struct initialiser, right? At least the constructor syntax doesn’t compile on the latest release.

---

<div class="post-metadata">

**Author:** ![Mathias\_Westerdahl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/mathias_westerdahl/32/228_2.png) [@Mathias\_Westerdahl](https://forum.defold.com/u/Mathias_Westerdahl)\
**Post date:** [December 16, 2021, 7:52am UTC](https://forum.defold.com/t/ne-updated-dmscript-luahbuffer-constructor/69931/4 "2021-12-16T07:52:41Z")

</div>

Sorry, I was confusing things a bit here.  
The enum was old, not the constructors.  
The constructors are the new thing that will come in 1.2.191.
