diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2025-03-16 09:52:50 +1100 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2025-03-16 09:52:50 +1100 |
commit | 6f51c2c129ab50872a4944e5218fcf97f89abb1d (patch) | |
tree | 005e6a4915092ff9c9e861638ae9c076cf9077ed | |
parent | c3299db812f4c2103b20f66b2de15084e8568fc7 (diff) |
add root.assetSourceMetadata
-rw-r--r-- | doc/lua/openstarbound/root.md | 4 | ||||
-rw-r--r-- | source/game/scripting/StarRootLuaBindings.cpp | 5 |
2 files changed, 9 insertions, 0 deletions
diff --git a/doc/lua/openstarbound/root.md b/doc/lua/openstarbound/root.md index e87a0fe..1009c8f 100644 --- a/doc/lua/openstarbound/root.md +++ b/doc/lua/openstarbound/root.md @@ -61,6 +61,10 @@ Returns the asset source path of an asset, or nil if the asset doesn't exist. If Without metadata: Returns an array with all the asset source paths. With metadata: Returns a table, key/value being source path/metadata. +#### `Json` root.assetSourceMetadata(`String` path) + +Returns the metadata of an asset source. + #### `Image` root.assetImage(`String` image) Returns an image. diff --git a/source/game/scripting/StarRootLuaBindings.cpp b/source/game/scripting/StarRootLuaBindings.cpp index b7c9a74..c45ef46 100644 --- a/source/game/scripting/StarRootLuaBindings.cpp +++ b/source/game/scripting/StarRootLuaBindings.cpp @@ -116,6 +116,11 @@ LuaCallbacks LuaBindings::makeRootCallbacks() { return table; }); + callbacks.registerCallback("assetSourceMetadata", [root](LuaEngine& engine, String const& assetSourcePath) { + auto assets = root->assets(); + return assets->assetSourceMetadata(assetSourcePath); + }); + callbacks.registerCallback("itemFile", [root](LuaEngine& engine, String const& itemName) -> Maybe<String> { return root->itemDatabase()->itemFile(itemName); }); |