MCPcopy Create free account
hub / github.com/defold/defold / LuaDeleteTexture

Function LuaDeleteTexture

engine/gui/src/gui_script.cpp:2254–2271  ·  view source on GitHub ↗

delete texture * Delete a dynamically created texture. * * @name gui.delete_texture * @param texture [type:string|hash] texture id * @examples * * ```lua * function init(self) * -- Create a texture. * if gui.new_texture("temp_tx", 10, 10, "rgb", string.rep('\0', 10 * 10 * 3)) then * -- Do something with the texture. *

Source from the content-addressed store, hash-verified

2252 * ```
2253 */
2254 static int LuaDeleteTexture(lua_State* L)
2255 {
2256 int top = lua_gettop(L);
2257 (void) top;
2258
2259 const dmhash_t name = dmScript::CheckHashOrString(L, 1);
2260
2261 Scene* scene = GuiScriptInstance_Check(L);
2262
2263 Result r = DeleteDynamicTexture(scene, name);
2264 if (r != RESULT_OK) {
2265 char buffer[128];
2266 luaL_error(L, "failed to delete texture '%s' (result = %d)", dmScript::GetStringFromHashOrString(L, 1, buffer, sizeof(buffer)), r);
2267 }
2268
2269 assert(top == lua_gettop(L));
2270 return 0;
2271 }
2272
2273 /*# set the buffer data for a texture
2274 * Set the texture buffer data for a dynamically created texture.

Callers

nothing calls this directly

Calls 7

lua_gettopFunction · 0.85
CheckHashOrStringFunction · 0.85
GuiScriptInstance_CheckFunction · 0.85
luaL_errorFunction · 0.85
DeleteDynamicTextureFunction · 0.70
assertFunction · 0.50

Tested by

no test coverage detected