lua/wrappers/util/lua_data_table.cpp
/**
	 * Removes the keys given list of strings.
	 * This takes a variable number of arguments which will be validated
	 * as being strings before a key is removed.
	 * It is not considered an error to remove a key that does not exist.
	 *
	 * <pre>
	 * DataTable = import("DataTable")
	 * table = DataTable.new()
	 * table:at("num", 5)
	 * table:at("str", "String")
	 * table:at("bool", true)
	 * 
	 * am_log("Size 1: " .. #table)	-- Outputs: Size 1: 3
	 * table:remove("num", "bool")
	 * 
	 * am_log("Size 2: " .. #table)	-- Outputs: Size 2: 1
	 * </pre>
	 * 
	 * @param string... keys The keys to remove.
	 * @returns DataTable This
	 */
Removes the keys given list of strings.
This takes a variable number of arguments which will be validated
as being strings before a key is removed.
It is not considered an error to remove a key that does not exist.







@param string... keys The keys to remove.
Removes the keys given list of strings . This takes a variable number of arguments which will be validated as being strings before a key is removed . It is not considered an error to remove a key that does not exist . @param string ... keys The keys to remove .
int DataTable_remove(lua_State *lua)
	{
		am::util::data::Table *table = castUData<am::util::data::Table>(lua, 1);
		if (table)
		{
			int args = lua_gettop(lua);
			if (args > 1)
			{
				bool valid = true;
				for (int n = 2; n < args; ++n)
				{
					if (!lua_isstr(lua, n) && !lua_isnum(lua, n))
					{
						valid = false;
						break;
					}
				}
				if (valid)
				{
					for (int n = 2; n < args; ++n)
					{
						if (lua_isstr(lua, n))
						{
							table->remove(lua_tostring(lua, n));
						}
						else
						{
							table->remove(lua_tointeger(lua, n));
						}
					}
					lua_first(lua);
				}
			}
			return LuaState::expectedArgs(lua, "remove", 2, "string/integer key/index ...");
		}
		return LuaState::expectedContext(lua, "remove", "DataTable");
	}
int DataTable_remove ( lua_State * lua ) { am :: util :: data :: Table * table = castUData < am :: util :: data :: Table > ( lua , 1 ) ; if ( table ) { int args = lua_gettop ( lua ) ; if ( args > 1 ) { bool valid = true ; for ( int n = 2 ; n < args ; ++ n ) { if ( ! lua_isstr ( lua , n ) && ! lua_isnum ( lua , n ) ) { valid = false ; break ; } } if ( valid ) { for ( int n = 2 ; n < args ; ++ n ) { if ( lua_isstr ( lua , n ) ) { table -> remove ( lua_tostring ( lua , n ) ) ; } else { table -> remove ( lua_tointeger ( lua , n ) ) ; } } lua_first ( lua ) ; } } return LuaState :: expectedArgs ( lua , " " , 2 , " " ) ; } return LuaState :: expectedContext ( lua , " " , " " ) ; }
Removes the keys given list of strings.
Removes the keys given list of strings .
// Make sure that all the arguments are strings before removing anything.