| 1083 | } |
| 1084 | |
| 1085 | static dmGraphics::HAssetHandle CheckAssetHandle(lua_State* L, int index, dmGraphics::HContext graphics_context, dmGraphics::AssetType expected_type) |
| 1086 | { |
| 1087 | assert(lua_isnumber(L, index)); |
| 1088 | |
| 1089 | dmGraphics::HAssetHandle asset_handle = (dmGraphics::HAssetHandle) lua_tonumber(L, 1); |
| 1090 | if (!dmGraphics::IsAssetHandleValid(graphics_context, asset_handle)) |
| 1091 | { |
| 1092 | char buf[128]; |
| 1093 | luaL_error(L, "Asset handle '%s' is not valid.", AssetHandleToString(asset_handle, buf, sizeof(buf))); |
| 1094 | return (dmGraphics::HAssetHandle) -1; |
| 1095 | } |
| 1096 | else if (dmGraphics::GetAssetType(asset_handle) != expected_type) |
| 1097 | { |
| 1098 | char buf[128]; |
| 1099 | luaL_error(L, "Asset handle '%s' does not have the correct type.", AssetHandleToString(asset_handle, buf, sizeof(buf))); |
| 1100 | return (dmGraphics::HAssetHandle) -1; |
| 1101 | } |
| 1102 | return asset_handle; |
| 1103 | } |
| 1104 | |
| 1105 | static dmGraphics::HRenderTarget CheckRenderTarget(lua_State* L, int index, RenderScriptInstance* i) |
| 1106 | { |
no test coverage detected