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. *
| 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. |
nothing calls this directly
no test coverage detected