feature: test.blob(name) reads blob assets from test scripts (#13005) afd68206e6
* fix(lua): register the name atom so Blob.name resolves instead of erroring

* feat(tests): test.blob(name) reads blob assets from test scripts

Co-authored-by: Luigi Rosso <luigi-rosso@users.noreply.github.com>
diff --git a/.rive_head b/.rive_head
index 638af8d..950e8f5 100644
--- a/.rive_head
+++ b/.rive_head
@@ -1 +1 @@
-a77c1355bdd6e26f733edfd531ec7871f942efcf
+afd68206e676b8b4d360a720a86068094740d330
diff --git a/include/rive/lua/rive_lua_libs.hpp b/include/rive/lua/rive_lua_libs.hpp
index 8b03697..e13a885 100644
--- a/include/rive/lua/rive_lua_libs.hpp
+++ b/include/rive/lua/rive_lua_libs.hpp
@@ -2252,5 +2252,15 @@
 // Implemented in lua_scripted_context.cpp.
 int lua_push_gpu_features(lua_State* L);
 
+#ifdef WITH_RIVE_TOOLS
+// Push a ScriptedBlob copying `data`, or an empty blob when data is null or
+// size is 0. Only tooling constructs blobs from loose bytes; the runtime
+// wraps in-file assets. Implemented in lua_blob.cpp.
+int lua_push_blob(lua_State* L,
+                  const char* name,
+                  const uint8_t* data,
+                  size_t size);
+#endif
+
 #endif
 #endif
diff --git a/src/lua/renderer/lua_blob.cpp b/src/lua/renderer/lua_blob.cpp
index dd3035e..c8ea5ca 100644
--- a/src/lua/renderer/lua_blob.cpp
+++ b/src/lua/renderer/lua_blob.cpp
@@ -67,6 +67,28 @@
     return 0;
 }
 
+#ifdef WITH_RIVE_TOOLS
+int lua_push_blob(lua_State* L,
+                  const char* name,
+                  const uint8_t* data,
+                  size_t size)
+{
+    auto scriptedBlob = lua_newrive<ScriptedBlob>(L);
+    if (data != nullptr && size > 0)
+    {
+        auto blobAsset = make_rcp<BlobAsset>();
+        if (name != nullptr)
+        {
+            blobAsset->name(name);
+        }
+        SimpleArray<uint8_t> bytes(data, size);
+        blobAsset->decode(bytes, nullptr);
+        scriptedBlob->asset = blobAsset;
+    }
+    return 1;
+}
+#endif
+
 int luaopen_rive_blob(lua_State* L)
 {
     lua_register_rive<ScriptedBlob>(L);
diff --git a/src/lua/rive_lua_libs.cpp b/src/lua/rive_lua_libs.cpp
index 78b12eb..457bc07 100644
--- a/src/lua/rive_lua_libs.cpp
+++ b/src/lua/rive_lua_libs.cpp
@@ -163,6 +163,7 @@
     {"image", (int16_t)LuaAtoms::image},
     {"blob", (int16_t)LuaAtoms::blob},
     {"size", (int16_t)LuaAtoms::size},
+    {"name", (int16_t)LuaAtoms::name},
     {"duration", (int16_t)LuaAtoms::duration},
     {"setTime", (int16_t)LuaAtoms::setTime},
     {"setTimeFrames", (int16_t)LuaAtoms::setTimeFrames},